I made a script and I am posting the details:
- Ease of use for designers
- The LESS compiler executes immediately after saving the file without using server resources.
- Any editor capable of remote editing will work with this solution - Code, Sublime Text, Textmate
First you need to install "npm" on the server by entering it in the console:
sudo apt-get install npm inotify-tools sudo npm install -g less sudo nano /usr/local/bin/lesscwatch
Paste the following into the file:
#!/bin/bash # Detect changes in .less file and automatically compile into .css [ "$2" ] || { echo "Specify both .less and .css files"; exit 1; } inotifywait . -m -e close_write | while read x op f; do. if [ "$f" == "$1" ]; then. lessc $f > $2 && echo "`date`: COMPILED";. fi done
Save, exit, and then execute:
sudo chmod +x /usr/local/bin/lesscwatch
You are all done. The next time you need to work with your LESS files, you will need to open a terminal (Coda has a built-in), go to your file folder (using cd) and do the following:
lesscwatch main.less main.css
It will display information about successful compilations or errors. Enjoy it.
romaninsh Nov 28 '12 at 16:45 2012-11-28 16:45
source share