Skip to content

Instantly share code, notes, and snippets.

@pelted
Forked from dnagir/min.rb
Created February 19, 2012 08:06
Show Gist options
  • Save pelted/1862538 to your computer and use it in GitHub Desktop.
Save pelted/1862538 to your computer and use it in GitHub Desktop.
Spine minimization sizes
require 'closure-compiler'
packages = {
bare: %w{spine.js},
core: %w{spine.js ajax.js route.js tmpl.js},
full: %w{ajax.js list.js local.js manager.js relation.js route.js spine.js tabs.js tmpl.js}
}
packages.each_pair do |package, files|
all = files.inject('') {|m, c| m + File.read("lib/#{c}") }
content = Closure::Compiler.new.compile all
puts "Package #{package} ready. Size #{all.length / 1024}kb -> #{content.length / 1024}kb."
File.open "spine-#{package}-min.js", 'w' do |f|
f.puts content
end
end
$ ruby min
Package bare ready. Size 21kb -> 11kb.
Package core ready. Size 34kb -> 18kb.
Package full ready. Size 49kb -> 26kb.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment