Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit fea099a

Browse files
committed
Load product grid styles in WP <=5.2 (#2000)
* Load product grid styles in WP <=5.2 * Explicitly exclude 'product-list-style' from default builds
1 parent 471d3a4 commit fea099a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

bin/webpack-helpers.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ const getAlias = ( options = {} ) => {
9898
const mainEntry = {
9999
// Shared blocks code
100100
blocks: './assets/js/index.js',
101+
102+
// Styles for grid blocks. WP <=5.2 doesn't have the All Products block,
103+
// so this file would not be included if not explicitly declared here.
104+
// This file is excluded from the default build so CSS styles are included
105+
// in the other the components are imported.
106+
'product-list-style': './assets/js/base/components/product-list/style.scss',
107+
101108
// Blocks
102109
'handpicked-products': './assets/js/blocks/handpicked-products/index.js',
103110
'product-best-sellers': './assets/js/blocks/product-best-sellers/index.js',

webpack.config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,14 @@ const CoreConfig = {
8383

8484
const GutenbergBlocksConfig = {
8585
...baseConfig,
86-
...getMainConfig( { alias: getAlias() } ),
86+
...getMainConfig( {
87+
alias: getAlias(),
88+
// This file is already imported by the All Products dependencies,
89+
// so we can safely exclude it from the default build. It's still
90+
// needed in the legacy build because it doesn't include the
91+
// All Products block.
92+
exclude: [ 'product-list-style' ],
93+
} ),
8794
};
8895

8996
const BlocksFrontendConfig = {

0 commit comments

Comments
 (0)