Switch to terser gem from uglifier for JS compression

closes #8268
This commit is contained in:
Pirate Praveen 2021-07-07 20:54:08 +05:30 committed by Benjamin Neff
parent 07a49de7e1
commit 20a3abd864
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
5 changed files with 7 additions and 6 deletions

View file

@ -5,6 +5,7 @@
* Fix html-syntax in some handlebars templates [#8251](https://github.com/diaspora/diaspora/pull/8251)
* Remove `chat_enabled` flag from archive export [#8265](https://github.com/diaspora/diaspora/pull/8265)
* Change thumbnails in image slideshow to squares [#8275](https://github.com/diaspora/diaspora/pull/8275)
* Replace uglifier with terser for JS compression [#8268](https://github.com/diaspora/diaspora/pull/8268)
## Bug fixes

View file

@ -46,7 +46,7 @@ gem "sidekiq-cron", "1.2.0"
# Compression
gem "uglifier", "4.2.0"
gem "terser", "1.1.5"
# Configuration

View file

@ -724,6 +724,8 @@ GEM
temple (0.8.2)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
terser (1.1.5)
execjs (>= 0.3.0, < 3)
thor (1.1.0)
thread_safe (0.3.6)
tilt (2.0.10)
@ -749,8 +751,6 @@ GEM
ethon (>= 0.9.0)
tzinfo (1.2.9)
thread_safe (~> 0.1)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.7)
@ -918,13 +918,13 @@ DEPENDENCIES
sinon-rails (= 1.15.0)
sprockets-rails (= 3.2.2)
string-direction (= 1.2.2)
terser (= 1.1.5)
timecop (= 0.9.4)
toml-rb (= 2.0.1)
turbo_dev_assets (= 0.0.2)
twitter (= 7.0.0)
twitter-text (= 1.14.7)
typhoeus (= 1.4.0)
uglifier (= 4.2.0)
unicorn (= 6.0.0)
unicorn-worker-killer (= 0.4.5)
uuid (= 2.3.9)

View file

@ -27,7 +27,7 @@ Rails.application.configure do
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
config.assets.js_compressor = :terser
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.

View file

@ -30,7 +30,7 @@ class BookmarkletRenderer
def compile
src = File.read(source)
@body = Uglifier.compile(src)
@body = Terser.compile(src)
FileUtils.mkdir_p cached_path.dirname
File.open(cached_path, "w") {|f| f.write(@body) }
end