I have only today started playing with compass
and haml
. While I am quite familiar with the way sass
works and I get the idea of what compass
is for sass
and how to use it, I've hit a little bit of a road block when it comes to using haml
efficiently.
Of course I am hoping that someone here already knows the answer to my problem and can give me a little jump start into haml
.
Here is what I'd like to accomplish: Auto compile my HAML files when I save them.
The project however is just a tiny static site (couple of pages) to build up a template set for a later integration into the ExpressionEngine CMS (a php
based solution).
So keeping in mind that myself using HAML to simply speed up the initial "Design to HTML/CSS" process, what is a good way to auto compile my HAML files into HTML, basically something that gives me a haml watch
command that I can run on my project?
Is there even something like this out there?
As for the platform I am running on, I've got a Mac running OS X 10.6.6.
Thanks for reading, any ideas, suggestions, help would be very much appreciated.
Thank you both @Jacob and @Jonathan, I ultimately ended up using neither of your approaches in favour of using middleman
, hence the answer to my own question.
For those reading this topic having a similar question in mind, the reason I like middleman
so much is that it effectively combines my entire workflow into 1 mini-server app.
Using mm-ini project_name
and then mm-server
in the directory I instantly have access to Compass, HAML and SASS all with the option of simply outputting it to plain html at any given time.
Here is more info about middleman
: http://middlemanapp.com/
Staticmatic and Nanoc also do HAML but as far as I could find out they do not 'out of the box' support Compass (SASS) compilation, which for some might be an upside but for me wasn't.
Again, thanks for your answers, here is however the answer that I ultimately chose to follow.
If you have Ruby installed you could use the watchr gem.
With the help of a little nice script that I found here you can start a process that recognizes any changes to your haml file.
Beneath you can find my customized watchr.rb
def compile_haml
%x[haml index.haml index.html]
end
def do_growl(message)
growlnotify = `which growlnotify`.chomp
title = "Watchr Message"
passed = message.include?('0 failures, 0 errors')
image = passed ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png"
severity = passed ? "-1" : "1"
options = "-w -n Watchr --image '#{File.expand_path(image)}'"
options << " -m '#{message}' '#{title}' -p #{severity}"
system %(#{growlnotify} #{options} &)
end
do_growl "Watching folders and waiting for changes..."
watch(".*\.haml$") { |x|
compile_haml
do_growl "Compiled HAML!"
}
If you do not have growl installed just leave that part away
I've found StaticMatic to be really good for building static web sites in HAML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With