Created
October 15, 2013 14:33
-
-
Save LBRapid/6992493 to your computer and use it in GitHub Desktop.
Using sprockets outside of rails
This file contains hidden or 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
| require 'rubygems' | |
| require 'sprockets' | |
| task :default => [:release] | |
| desc "Release the application" | |
| task :release do | |
| puts "Compiling JavaScript assets...hang tight!" | |
| project_root = File.expand_path(File.dirname(__FILE__)) | |
| assets = Sprockets::Environment.new(project_root) | |
| assets.append_path(File.join(project_root, 'javascripts')) | |
| manifest = assets['manifest.js'] | |
| outpath = File.join(project_root, 'release') | |
| outfile = Pathname.new(outpath).join('application.min.js') | |
| FileUtils.mkdir_p outfile.dirname | |
| manifest.write_to(outfile) | |
| puts "Successfully compiled JavaScript assets!" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment