Skip to content

Instantly share code, notes, and snippets.

@andreyvit
Created July 12, 2010 10:41
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save andreyvit/472349 to your computer and use it in GitHub Desktop.
Save andreyvit/472349 to your computer and use it in GitHub Desktop.
require 'rake/clean'
HAML = FileList['**/*.haml']
LESS = FileList['**/*.less']
COFFEE = FileList['**/*.coffee']
HTML = HAML.ext('html')
CSS = LESS.ext('css')
JS = COFFEE.ext('js')
CLOBBER.include(HTML, CSS, JS)
rule '.html' => '.haml' do |t|
puts " HAML #{t.source}"
sh 'haml', t.source, t.name
end
rule '.css' => '.less' do |t|
puts " LESS #{t.source}"
sh 'lessc', t.source, t.name
end
rule '.js' => '.coffee' do |t|
puts "COFFEE #{t.source}"
sh 'coffee', '-c', t.source
end
desc "Build all HTML, CSS and JavaScript files"
task :default => (HTML + CSS + JS)
desc "Continuously watch for changes and rebuild files"
task :watch => [:default] do
require 'rubygems'
require 'fssm'
def rebuild
sh 'rake'
puts " OK"
rescue
nil
end
begin
FSSM.monitor(nil, ['**/*.coffee', '**/*.haml', '**/*.less']) do
update { rebuild }
delete { rebuild }
create { rebuild }
end
rescue FSSM::CallbackError => e
Process.exit
end
end
@andreyvit
Copy link
Author

@niksosf To avoid spamming everyone here, please contact me at andreyvit@gmail.com for further assistance. Also, if you are serious about web development, please stop using Windows, it will always be making things more difficult for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment