-
-
Save adamjspooner/991297 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 '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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Changes: