Created
November 4, 2010 23:01
-
-
Save jimsynz/663354 to your computer and use it in GitHub Desktop.
Rebuild static HAML and SASS files as changes are saved.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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