Skip to content

Commit 3ebed77

Browse files
committed
Fix the CSS being broken on first starting dev mode
This really needs moving entirely to the @wordpress/scripts system, but it also involves a revamp of bundling a plugin.
1 parent 6f9a7bb commit 3ebed77

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"license": "GPL-2.0-or-later",
88
"scripts": {
99
"env": "wp-env",
10-
"start": "yarn build-css && wp-scripts start & node-sass --watch editor.scss -o build & node-sass --watch style.scss -o build",
10+
"start": "yarn build-css & wp-scripts start & node-sass --watch editor.scss -o build & node-sass --watch style.scss -o build",
1111
"build": "wp-scripts build && yarn build-css",
1212
"build-css": "node-sass ./editor.scss -o build | postcss build/editor.css -u autoprefixer -b 'last 2 versions' -r --no-map && node-sass ./style.scss -o build | postcss build/style.css -u autoprefixer -b 'last 2 versions' -r --no-map",
1313
"plugin": "yarn clean && node ./bundler/build",

webpack.config.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* External dependencies
3+
*/
4+
const { CleanWebpackPlugin } = require( 'clean-webpack-plugin' );
5+
6+
/**
7+
* WordPress dependencies
8+
*/
9+
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
10+
11+
module.exports = {
12+
...defaultConfig,
13+
14+
// Disable the clean plugin as it kills our CSS
15+
plugins: defaultConfig.plugins.filter(
16+
( plugin ) => ! ( plugin instanceof CleanWebpackPlugin )
17+
),
18+
};

0 commit comments

Comments
 (0)