我正在使用一个已预编译包括Bootstrap样式的CSS文件的旧代码库,我想通过PurgeCSS运行它们以删除所有未使用的样式。
这是我到目前为止所拥有的:
package.json
{
"private": true,
"devDependencies": {
"autoprefixer": "^9.7.6",
"cssnano": "^4.1.10",
"git-rev-sync": "^2.0.0",
"glob-all": "^3.1.0",
"laravel-mix-purgecss": "^4.2.0",
"purgecss-webpack-plugin": "^2.1.2"
},
"dependencies": {
"cross-env": "^7.0.0",
"hover.css": "^2.3.2",
"laravel-mix": "^5.0.1"
},
"scripts": {
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
}
}
webpack.mix.js
const mix = require("laravel-mix");
require("laravel-mix-purgecss");
mix.purgeCss({
content: [
path.join(__dirname, "templates/**/*.html"),
path.join(__dirname, "html/assets/js/*.js"),
],
css: [
'./html/assets/css/one.css',
'./html/assets/css/two.css'
]
});
运行npm run production
时,我收到一条成功编译的消息,但是没有文件被更改。
我想念什么?