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