rollup-plugin-css-only
rollup-plugin-css-only copied to clipboard
How to minify the output css?
Is there any way to compress the output css file?
plugins: [
nodeResolve(),
commonjs(),
babel(getBabelOptions(isModern)),
vue({
css: false,
compileTemplate: true
}),
css({ output: 'index.css' }),
banner(getBanner()),
terser(getTerserOptions())
]
@BryanAdamss I did this and it worked well (hope it helps)
import fs from 'fs';
// 1. using csso for minifying the css
import { minify } from 'csso';
export default {
plugins: [
css({
// 2. on output do the minification
output: function (styles) {
fs.writeFileSync(`dist/${name}.css`, minify(styles).css);
},
}),
vue({
css: false,
}),
]
};
Here's a new way to do it, based on documentation:
css({ minify: true })