Automatically compile LESS files
A nice feature of Compass is that it provides a watch
command line option. When you pass this option, compass automatically compiles SASS files when they are saved.
LESS doesn’t provide a similar option, so I created lesswatch.
It uses watchdog’s watchmedo
script, which can run a command when a file change is detected. watchdog is implemented in Python and can be installed from PyPi. Compilation from LESS to CSS is performed by lessc.
lesswatch is a command line script (no idea what a command line is? have a read of The Designers Guide to the OS X Command Prompt) that watches directories you specify for LESS file changes:
$ lesswatch media/css
compile: /Users/john/media/css/sample.less
wrote: /Users/john/media/css/sample.css
compile: /Users/john/media/css/sample.less
Syntax Error on line 2 in /Users/john/media/css/sample.less
1 body {
2 background:
3 }
You can download lesswatch from GitHub.