Created
November 8, 2011 03:44
-
-
Save dnagir/1346939 to your computer and use it in GitHub Desktop.
Spine minimization
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
files = %w{ajax.js list.js local.js manager.js relation.js route.js spine.js tabs.js tmpl.js} | |
all = files.inject('') {|m, c| m + File.read("lib/#{c}") } | |
puts "Initial size: #{all.length / 1024}kb" # => | |
require 'closure-compiler' | |
content = Closure::Compiler.new.compile all | |
puts "Compressed size: #{content.length / 1024}kb" | |
File.write('spine-min.js', content) |
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 | |
Initial size: 49kb | |
Compressed size: 26kb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment