Created
November 8, 2011 04:01
-
-
Save dnagir/1346964 to your computer and use it in GitHub Desktop.
Spine minimization sizes
This file contains 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 '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 |
This file contains 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
$ 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