I am trying to add cssnano optimization rules but with vue-cli, it doesn't seem to work. I added the following script in vue.config.js
:
module.exports = {
css: {
loaderOptions: {
postcss: {
plugins: [
require("cssnano")({
preset: [
"default",
{
discardComments: {
removeAll: true
},
mergeRules: true
}
]
})
]
}
}
}
};
But it wouldn't work (see screenshot below)
Screenshot - cssnano mergeRules
didn't apply:
What did I miss?
You have to modify chainWebpack api to edit cssnano plugin options.
Source: https://forum.vuejs.org/t/vue-cli-3-remove-svgo-from-cssnano-optimizations/53560/2