Hi,
Is it posible to include an option to remove unused css?
It is very useful for people who use HTML templates, LESS loads a lot of module, but very few is actually used.
If not, how should I extend Mix???
I appended
const path = require('path');
const glob = require('glob');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const PurifyCSSPlugin = require('purifycss-webpack');
module.exports = {
module: {
rules: [
{
test: /\.css$/,
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style-loader',
loader: 'css-loader'
})
}
]
},
plugins: [
new ExtractTextPlugin('[name].[contenthash].css'),
// Make sure this is after ExtractTextPlugin!
new PurifyCSSPlugin({
// Give paths to parse for rules. These should be absolute!
paths: glob.sync(path.join(__dirname, 'app/*.html')),
})
]
};
as mentioned in plugin docs, but it is not doing the job...
I've pushed an initial pass at this to master. We'll tag it this week, likely. Once we do, you can turn it on with:
mix.options({ purifyCss: true });
Is there a way to pull this, or should we just wait for new release?
Most helpful comment
I've pushed an initial pass at this to master. We'll tag it this week, likely. Once we do, you can turn it on with: