Skip to content

Instantly share code, notes, and snippets.

@dnagir
Created November 8, 2011 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dnagir/1346964 to your computer and use it in GitHub Desktop.
Save dnagir/1346964 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.write "spine-#{package}-min.js", content
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