Created
November 15, 2012 14:35
-
-
Save LeonFedotov/4078922 to your computer and use it in GitHub Desktop.
coffee-script with sourcemaps
This file contains 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
COFFEE_EXEC = '/Users/leon/code/resources/CoffeeScriptRedux/bin/coffee' #https://github.com/michaelficarra/CoffeeScriptRedux/ | |
def create_js(source) | |
target = "#{File.dirname(source)}/js/#{File.basename(source, '.coffee')}.js" | |
puts "#{COFFEE_EXEC} --js -i #{source} > #{target}" | |
%x{#{COFFEE_EXEC} --js -i #{source} > #{target}} | |
puts "#{COFFEE_EXEC} --source-map -i #{source} > #{target}.map" | |
%x{#{COFFEE_EXEC} --source-map -i #{source} > #{target}.map} | |
puts "(echo; echo '//@ sourceMappingURL=#{target}.map') >> #{target}" | |
%x{(echo; echo '//@ sourceMappingURL=#{target}.map') >> #{target}} | |
end | |
Dir.foreach(Dir.pwd) do |file| | |
create_js(file) if File.extname(file) == '.coffee' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment