Hacker News new | past | comments | ask | show | jobs | submit login

I use this to compile my LESS scripts already. I was always getting really frustrated with the options with LESS... either compile in the browser, or compile manually. Both were actually a bit of a pain, (caching being the biggest annoyance for browser compilation).

So I used inotifywait...

It would check for any modifications to my "CSS" folders recursively, and it would then run my custom less compilation script [1] ...

     #!/bin/bash
     while inotifywait -e modify -r /var/www/site/public/static/css/base; do
       cd /var/www/site/public/static/css; node compile;
     done
(I also hooked this up to Fab [2], and used a "start"/"stop" script [3] to pause the watch, so that I could manually control when inotify wait would be watching.

[1] https://gist.github.com/3497304 (My Custom LESS compile Script)

[2] http://docs.fabfile.org/en/1.4.3/index.html ( Fabric Command Line Tool )

[3] https://gist.github.com/3497308 (Sample Fab Command )

If it would benefit anyone to know in greater details, I'd be happy to write a blog post about automating compilation using these tools.




I solved this problem using http://leafo.net/lessphp/. Obviously that only works if you are programming in PHP, but I would imagine there are similar solutions available for other languages?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: