Skip to content

Instantly share code, notes, and snippets.

@mynyml
Created October 3, 2009 18:58
Show Gist options
  • Save mynyml/200817 to your computer and use it in GitHub Desktop.
Save mynyml/200817 to your computer and use it in GitHub Desktop.
# Run me with:
#
# $ watchr less.watchr
# --------------------------------------------------
# Helpers
# --------------------------------------------------
def lessc(file)
print "compiling #{file.inspect}... "
system "lessc #{file}"
puts 'done'
end
# --------------------------------------------------
# Watchr Rules
# --------------------------------------------------
watch ( '.*\.less$' ) {|md| lessc md[0] }
# --------------------------------------------------
# Signal Handling
# --------------------------------------------------
# Ctrl-\
Signal.trap('QUIT') do
puts " --- Compiling all .less files ---\n\n"
Dir['**/*.less'].each {|file| lessc file }
puts 'all compiled'
end
# Ctrl-C
Signal.trap('INT') { abort("\n") }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment