Languages
[Edit]
EN

LESS / CSS - minify css file

8 points
Created by:
AnnLen
8880

In this short article we want to show how to compress *.css files with lessc command.

Quick solution:

lessc input_file.css --clean-css="--s1 --advanced --compatibility=ie8" > output_file.min.css

Note: read below description to know how to install lessc command.

Screenshot:

css compression result with lessc command
css compression result with lessc command (file was compressed about 65%)

lessc instalation example

To install lessc it is necessary to do few steps:

  1. be sure that NodeJS is installed (instalation instruction for Windows is avaialble here),
  2. install less with following command:
    npm install -g less
  3. install lessc with following command:
    npm install -g less-plugin-clean-css
    Output:
    + less-plugin-clean-css@1.5.1
    added 6 packages from 39 contributors in 1.858s
  4. now we can use lessc command (go back to Quick solution).

References

  1. less-plugin-clean-css - npm 
Native Advertising
50 000 ad impressions - 449$
🚀
Get your tech brand or product in front of software developers.
For more information contact us:
Red dot
Dirask - friendly IT community for everyone.

❤️💻 🙂

Join