Skip to content
This repository was archived by the owner on Jan 11, 2024. It is now read-only.

Commit 44d09ae

Browse files
committed
Adding header + version number to -min.js
1 parent 13993f4 commit 44d09ae

File tree

3 files changed

+33
-20
lines changed

3 files changed

+33
-20
lines changed

Rakefile

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
require 'rubygems'
22
require 'closure-compiler'
33

4+
HEADER = /((^\s*\/\/.*\n)+)/
5+
46
desc "Use the Closure Compiler to compress Underscore.js"
57
task :build do
6-
js = File.open('underscore.js', 'r')
7-
min = Closure::Compiler.new.compile(js)
8-
File.open('underscore-min.js', 'w') {|f| f.write(min) }
8+
source = File.read('underscore.js')
9+
header = source.match(HEADER)
10+
min = Closure::Compiler.new.compress(source)
11+
File.open('underscore-min.js', 'w') do |file|
12+
file.write header[1].squeeze(' ') + min
13+
end
914
end
1015

1116
desc "Build the docco documentation"

underscore-min.js

+24-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

underscore.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Underscore.js 1.1.2
12
// (c) 2010 Jeremy Ashkenas, DocumentCloud Inc.
23
// Underscore is freely distributable under the MIT license.
34
// Portions of Underscore are inspired or borrowed from Prototype,

0 commit comments

Comments
 (0)