npm install @fullhuman/purgecss-loader --save-dev
Here is an example of how to use the loader in a Webpack configuration with Vue.js Single File Components:
{
module: {
rules: [
{
test: /\.css$/,
use: [
{
loader: 'css-loader',
options: { importLoaders: 1 }
},
{
loader: '@fullhuman/purgecss-loader',
options: {
content: [
path.join(__dirname, 'src/components/**/*.vue')
],
whitelistPatterns: [
/alert/
]
}
}
]
}
]
}
}