Skip to content

Instantly share code, notes, and snippets.

@aledalgrande
Created May 9, 2011 21:12
Show Gist options
  • Save aledalgrande/963428 to your computer and use it in GitHub Desktop.
Save aledalgrande/963428 to your computer and use it in GitHub Desktop.
namespace :release do
task :js => :environment do
puts "Compiling coffeescript to javascript..."
[...]
File.open("#{release_dir}/example.js", 'w') do |file|
file.write CoffeeScript.compile(File.read("#{dev_dir}/example.coffee"))
end
puts "Coffeescript compiled"
puts "Closure Compiler: minifying"
raw = File.read("#{release_dir}/example.js")
File.open("#{release_dir}/example.js", 'w') do |f|
output = Closure::Compiler.new.compile(raw)
f.write "/**\n Copyright 2011 Alessandro Dal Grande\n\n Example #{I18n.l Time.now}\n*/"
f.write output
end
puts "Closure Compiler: success"
end
end
# EDIT: added the closure compiler call, that went lost in the first version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment