Install Less compiler on Mac OS X
Less is a dynamic CSS preprocessor that enables lots of extra features for your boring old stylesheets.
Here’s how to install it on Mac OS X:
- Install an up-to-date version of npm
- Run the less installer
npm install -g less
- Now compile something
lessc style.less style.css
We can also enable a “file watcher” in PhpStorm or WebStorm so that less compilation is automatic:
- Find out where lessc program is located
which lessc
- Usually this will be
/usr/local/bin/lessc
, so you can use this path to set up the “Program” parameter in *Storm program. - Go to “Preferences” in PhpStorm and search for “File Watchers” and set up Less here with the Program path from above. You should be prompted to do this automatically if you open up a *.less file.