How to automatically compile LESS into CSS on the server?

前端 未结 3 722
温柔的废话
温柔的废话 2021-01-31 06:43

Friend designer of mine was compiling his LESS file manually and uploading it with Coda (Remote Site) spending lots of precious time. He asked me:

Is it possible to aut

3条回答
  •  自闭症患者
    2021-01-31 06:55

    i'd like the bash script but I had some trouble using it with sublime wthin ubuntu 12.10 . well, the scripts did the same Ian_Marcinkowski does, but I am sure it keeps working after first event, and monitor all files (sublime text someway, use a tmp file, and do not change the original one - !?!).

    #!/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
        echo $f
        echo "Change detected. Recompiling...";
        lessc $2 > $3 && echo "`date`: COMPILED";
    done
    

    call the script like :

    ./monitor.sh     
    

提交回复
热议问题