2 years ago

#67139

test-img

sg1234

Minifying a CSS file using terser

I have had some success minifying a .js file using terser. However, I have so far not been able to minify a standalone CSS file, and this is the reason for this qestion. I have installed html-minifier-terser, which minifies an HTML file, including any css or javascript code inside it (if the appropriate options are passed). My question is specifically with respect to minifying a standalone .css file: is there a terser command to minify a CSS file?

For example, the following command does not fully work for me (a new file is created with the whitespace removed, but /* ... */ comments are not):

html-minifier-terser mycss.css -o mycss.min.css --collapse-whitespace --remove-comments --minify-css true

(Also, using the javascript minifier does not work as the CSS is not legal javascript.)

css

minify

terser

0 Answers

Your Answer

Accepted video resources