* Load product grid styles in WP <=5.2

* Explicitly exclude 'product-list-style' from default builds
This commit is contained in:
Albert Juhé Lluveras 2020-03-31 12:46:38 +02:00 committed by GitHub
parent f2b5448c66
commit 6df879a922
2 changed files with 14 additions and 1 deletions

View File

@ -115,6 +115,12 @@ const stableMainEntry = {
'snackbar-notice-style': 'snackbar-notice-style':
'./node_modules/wordpress-components/src/snackbar/style.scss', './node_modules/wordpress-components/src/snackbar/style.scss',
// Styles for grid blocks. WP <=5.2 doesn't have the All Products block,
// so this file would not be included if not explicitly declared here.
// This file is excluded from the default build so CSS styles are included
// in the other the components are imported.
'product-list-style': './assets/js/base/components/product-list/style.scss',
// Blocks // Blocks
'handpicked-products': './assets/js/blocks/handpicked-products/index.js', 'handpicked-products': './assets/js/blocks/handpicked-products/index.js',
'product-best-sellers': './assets/js/blocks/product-best-sellers/index.js', 'product-best-sellers': './assets/js/blocks/product-best-sellers/index.js',

View File

@ -108,7 +108,14 @@ const CoreConfig = {
const GutenbergBlocksConfig = { const GutenbergBlocksConfig = {
...baseConfig, ...baseConfig,
...getMainConfig( { alias: getAlias() } ), ...getMainConfig( {
alias: getAlias(),
// This file is already imported by the All Products dependencies,
// so we can safely exclude it from the default build. It's still
// needed in the legacy build because it doesn't include the
// All Products block.
exclude: [ 'product-list-style' ],
} ),
}; };
const BlocksFrontendConfig = { const BlocksFrontendConfig = {