Przeglądaj źródła

Replace uglifier with terser

> UglifyJS only works with ES5. If you need to compress ES6, ruby-terser is a better option.

https://github.com/ahorek/terser-ruby
Simon Legner 1 rok temu
rodzic
commit
66d682eae9
3 zmienionych plików z 5 dodań i 5 usunięć
  1. 1 1
      Gemfile
  2. 3 3
      Gemfile.lock
  3. 1 1
      lib/app.rb

+ 1 - 1
Gemfile

@@ -31,7 +31,7 @@ end
 
 group :production do
   gem 'newrelic_rpm'
-  gem 'uglifier'
+  gem "terser"
 end
 
 group :development do

+ 3 - 3
Gemfile.lock

@@ -113,6 +113,8 @@ GEM
     strings-ansi (0.2.0)
     terminal-table (3.0.2)
       unicode-display_width (>= 1.1.1, < 3)
+    terser (1.1.20)
+      execjs (>= 0.3.0, < 3)
     thin (1.8.2)
       daemons (~> 1.0, >= 1.0.9)
       eventmachine (~> 1.0, >= 1.0.4)
@@ -127,8 +129,6 @@ GEM
       ethon (>= 0.9.0)
     tzinfo (2.0.6)
       concurrent-ruby (~> 1.0)
-    uglifier (4.2.0)
-      execjs (>= 0.3.0, < 3)
     unicode-display_width (2.3.0)
     unicode_utils (1.4.0)
     unix_utils (0.0.15)
@@ -166,11 +166,11 @@ DEPENDENCIES
   sprockets-helpers
   sprockets-sass
   terminal-table
+  terser
   thin
   thor
   tty-pager
   typhoeus
-  uglifier
   unix_utils
   yajl-ruby
 

+ 1 - 1
lib/app.rb

@@ -94,7 +94,7 @@ class App < Sinatra::Application
         ['/manifest.json',  { 'Cache-Control' => 'public, max-age=86400'  }]
       ]
 
-    sprockets.js_compressor = Uglifier.new output: { :harmony => true, beautify: true, indent_level: 0 }
+    sprockets.js_compressor = :terser
     sprockets.css_compressor = :sass
 
     Sprockets::Helpers.configure do |config|