Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

28 lines (22 sloc) 0.666 kB
# Script to watch a directory for any changes to a haml file
# and compile it.
#
# USAGE: ruby haml_watch.rb <directory_to_watch>
#
require 'rubygems'
require 'fssm'
#source_dir = Dir.pwd + "/" + ARGV.first
#source_dir = ARGV.first
source_dir = "../haml"
dest_dir = "../"
puts "Monitoring " + source_dir
puts "Target Dir: " + dest_dir
FSSM.monitor(source_dir, '**/*.haml') do
update do |base, relative|
input = source_dir + "/" + "#{relative}"
output = dest_dir + "/" + "#{relative.gsub!('.haml', '.html')}"
command = "haml #{input} #{output}"
%x{#{command}}
puts "Regenerated #{input} to #{output}"
end
end
Jump to Line
Something went wrong with that request. Please try again.