Created
August 26, 2013 17:36
-
-
Save atombender/6344219 to your computer and use it in GitHub Desktop.
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 'uglifier' | |
require 'yaml' | |
desc 'Create bundle file' | |
task :bundle do | |
main_file = File.expand_path('../index.js', __FILE__) | |
YAML.load(File.open('bundles.yml')).each do |name, opts| | |
flags = [] | |
if (excludes = [opts['excludes']].flatten) | |
excludes.each do |exclude| | |
flags.push "-x #{exclude}" | |
end | |
end | |
out_file = "#{name}.min.js" | |
File.open(out_file, "w:utf-8") do |f| | |
f.write Uglifier.compile( | |
`browserify #{flags.join(' ')} #{main_file}`) | |
end | |
puts "Wrote \e[32;1m#{out_file}\e[0m" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment