Skip to content

Instantly share code, notes, and snippets.

@jimsynz
Created November 4, 2010 23:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimsynz/663354 to your computer and use it in GitHub Desktop.
Save jimsynz/663354 to your computer and use it in GitHub Desktop.
Rebuild static HAML and SASS files as changes are saved.
require 'rubygems'
require 'fssm'
monitor = FSSM::Monitor.new
monitor.path File.dirname(__FILE__) do
update do |base,relative|
# Why are they not strings?!?
base = base.to_s
relative = relative.to_s
extension = relative.split('.').last
source = relative
target = (relative.split('.')[0..-2]) * '.'
if extension == 'haml'
puts "Converting haml file: #{source} => #{target}"
system "haml #{File.join(base,source)} #{File.join(base,target)}"
elsif extension == 'sass'
puts "Converting sass file: #{source} => #{target}"
system "sass #{File.join(base, source)} #{File.join(base,target)}"
end
end
end
monitor.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment