public
Created

Watches js/*.js and builds appropriately

  • Download Gist
watch_js.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#!/usr/bin/env ruby
require 'rubygems'
require 'fssm'
 
puts "*** Now watching JS files..."
 
FSSM.monitor(Dir.pwd, ['js/*.js', 'Jimfile']) do
update do |base, relative|
unless relative.include?('bundled.js')
puts "*** #{relative} changed!"
system "jim bundle"
end
end
 
create do |base, relative|
unless relative.include?('bundled.js')
puts "*** #{relative} created!"
system "jim bundle"
end
end
 
delete do |base, relative|
puts "*** #{relative} deleted!"
system "jim bundle"
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.