- PurifyCSS plugin/loader for webpack.
npm install purifycss-loader
var PurifyCssPlugin = require('purifycss-loader/PurifyCssPlugin');
var webpackConfig = {
// ...
module: {
loaders: [{
test: /\.css$/, loader: "style-loader!css-loader!purifycss-loader"
}]
},
plugins: [
new PurifyCssPlugin(__dirname, '/index.html')
]
}
Pass in the filepath to the root html for us to detect classes there. PurifyCSS will look at all your bundles on its own.