Skip to content

Instantly share code, notes, and snippets.

@adamjspooner
Forked from andreyvit/Rakefile
Created May 25, 2011 16:27
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 adamjspooner/991297 to your computer and use it in GitHub Desktop.
Save adamjspooner/991297 to your computer and use it in GitHub Desktop.
require 'rake/clean'
STYLUS = FileList['./**/*.styl']
COFFEE = FileList['./**/*.coffee']
CSS = STYLUS.ext('css')
JS = COFFEE.ext('js')
CLOBBER.include(CSS, JS)
rule '.css' => '.styl' do |t|
sh 'stylus', t.source
end
rule '.js' => '.coffee' do |t|
sh 'coffee', '-c', t.source
end
desc "Build all CSS and JavaScript files"
task :default => (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', '**/*.styl']) do
update { rebuild }
delete { rebuild }
create { rebuild }
end
rescue FSSM::CallbackError => e
Process.exit
end
end
@adamjspooner
Copy link
Author

Changes:

  • Switched .less for .styl
  • Removed .haml
  • Remove line noise since stylus and coffee stdout the same information

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