Skip to content
Browse files

Switch build from jsmin to the (more supported) uglifier.

  • Loading branch information...
1 parent b28a3ff commit 239e9253d792171c32491137570e4a1685d24e65 @fblee fblee committed May 2, 2013
Showing with 26 additions and 3 deletions.
  1. +3 −0 Gemfile
  2. +15 −0 Gemfile.lock
  3. +8 −3 Rakefile
View
3 Gemfile
@@ -0,0 +1,3 @@
+source "https://rubygems.org/"
+
+gem 'uglifier'
View
15 Gemfile.lock
@@ -0,0 +1,15 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ execjs (1.4.0)
+ multi_json (~> 1.0)
+ multi_json (1.7.2)
+ uglifier (2.0.1)
+ execjs (>= 0.3.0)
+ multi_json (~> 1.0, >= 1.0.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ uglifier
View
11 Rakefile
@@ -10,10 +10,11 @@ end
task :release do
begin
- require 'jsmin'
+ require 'uglifier'
rescue LoadError
- abort "jsmin is not available. In order to run rake release you must: gem install jsmin"
+ abort "Cannot load uglifier, is it installed?"
end
+
version = `git describe --tags --always --dirty`.sub('v', '').tr('-','.').chomp
puts "Writing: release/model-r-#{version}.js"
File.open("release/model-r-#{version}.js", 'w') do |output|
@@ -24,10 +25,14 @@ task :release do
end
puts "Writing: release/model-r-#{version}.min.js"
+ uglified, source_map = Uglifier.new.compile_with_map(File.read("release/model-r-#{version}.js"))
+
File.open("release/model-r-#{version}.min.js", 'w') do |minified|
minified.write("/*** model-r-#{version}.min.js ***/")
- minified.write(JSMin.minify(File.read("release/model-r-#{version}.js")))
+ minified.write(uglified)
end
+
+ File.open("release/model-r-#{version}.map", 'w') {|f| f.write(source_map) }
end
task :default => :release

0 comments on commit 239e925

Please sign in to comment.
Something went wrong with that request. Please try again.