forked from jashkenas/underscore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove the advanced_optimizations concessions and the advanced_optimi…
…zations rake task. Simple will do.
- Loading branch information
Showing
2 changed files
with
43 additions
and
75 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,10 @@ | ||
require 'rubygems' | ||
require 'closure-compiler' | ||
|
||
desc "Use the Closure Compiler to compress Underscore.js" | ||
task :build do | ||
js = File.open('underscore.js', 'r') | ||
min = Closure::Compiler.new.compile(js) | ||
File.open('underscore-min.js', 'w') {|f| f.write(min) } | ||
end | ||
|
||
task :build_advanced do | ||
js = File.read('underscore.js') | ||
# remove wrapping anonymous function as this messes with closure compiler | ||
# see | ||
# http://groups.google.com/group/closure-compiler-discuss/browse_thread/thread/b59b54c1a0073aa5 | ||
js.sub!('(function() {', '').chomp!("_.initWrapper();\n})();\n") | ||
compiler = Closure::Compiler.new \ | ||
:compilation_level => 'ADVANCED_OPTIMIZATIONS', | ||
:formatting => 'PRETTY_PRINT' | ||
min = compiler.compile(js) | ||
File.open('underscore-min2.js', 'w') {|f| f.write(min) } | ||
# | ||
original_size = js.length | ||
minimized_size = min.length | ||
puts original_size, minimized_size | ||
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