10行代码实现coffeescript全自动编译成js(linux/mac os)

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

require 'fssm'

FILE_PATH = '/home/yourpath/'

def compile(path)
	system "coffee -c #{path}"
end

FSSM.monitor FILE_PATH,'**/*.coffee' do
  update {|base, relative| compile "#{base}/#{relative}"}
  delete {|base, relative| system "rm #{base}/#{relative}".sub(/\.coffee$/,'.js')}
  create {|base, relative| compile "#{base}/#{relative}"}
end