Haml Autocompiler
Wednesday 03/24/2010 – Category: Uncategorized
On a project at work I've been using Compass, a nice stylesheet authoring tool that uses Sass. It has a nice feature that autocompiles all your Sass files to CSS whenever they change.
Since I was using Haml in conjunction with Compass, I thought it would be nice to be able to do the same for my Haml files instead of having to do haml test.haml > test.html every time.
So, here's a simple shell script you can use that will do just that. Just place it in a bin directory in your $PATH and run it in the directory you want to watch.
2 Responses to “Haml Autocompiler”
Leave a Reply
Recent Posts
- Flickr Original updates
(Saturday 08/7/2010 – 7 Comments) - LED Light for iPhone 4
(Monday 06/28/2010 – 48 Comments) - WWDC 2010: Worth Every Minute
(Monday 06/14/2010 – No Comments) - Flickr Original for Safari 5!
(Wednesday 06/9/2010 – 26 Comments)

March 25th, 2010 at 3:06 am
I have a few suggestions. First, this would probably be significantly faster if it used the Haml Ruby API (see http://haml-lang.com/docs/yardoc/Haml.html). Second, when using the command-line interface, it’s preferable to use “haml input.haml output.html”, rather than manually redirecting the output in the shell (this way, Haml knows what file it’s outputting to and can sometimes provide better debugging information). Third, I would suggest using FSSM (http://github.com/ttilley/fssm) for monitoring the filesystem, which can hook into native filesystem-watchers.
March 25th, 2010 at 9:18 am
thanks nathan, i will try out those suggestions!