diff --git a/Gemfile b/Gemfile index 83c27aa9..595641ff 100644 --- a/Gemfile +++ b/Gemfile @@ -167,3 +167,5 @@ gem 'browser', "~> 4.2" gem "rack-utf8_sanitizer", "~> 1.7" # gem "tailwindcss-rails", "~> 2.0" + +gem "terser", "~> 1.2" diff --git a/Gemfile.lock b/Gemfile.lock index 04359812..b0871a81 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -501,6 +501,8 @@ GEM net-sftp (>= 2.1.2) net-ssh (>= 2.8.0) stringio (3.1.0) + terser (1.2.2) + execjs (>= 0.3.0, < 3) thor (1.3.1) tilt (2.3.0) timeout (0.4.1) @@ -602,6 +604,7 @@ DEPENDENCIES sprockets-rails sqlite3 (~> 1.4) starburst! + terser (~> 1.2) turbolinks (~> 5.2) twitter-bootstrap-rails! twitter-typeahead-rails! diff --git a/config/environments/production.rb b/config/environments/production.rb index 6fd99cb4..71edec65 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -21,10 +21,11 @@ # config.require_master_key = true # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead. - # config.public_file_server.enabled = false + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JS assets. Needed for Sprockets - config.assets.js_compressor = Uglifier.new(harmony: true) + # config.assets.js_compressor = Uglifier.new(harmony: true) + config.assets.js_compressor = :terser # Compress CSS using a preprocessor. # config.assets.css_compressor = :sass diff --git a/config/environments/remotedev.rb b/config/environments/remotedev.rb index e655651c..30c339b4 100644 --- a/config/environments/remotedev.rb +++ b/config/environments/remotedev.rb @@ -19,7 +19,8 @@ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. - config.assets.js_compressor = Uglifier.new(harmony: true) + config.assets.js_compressor = :terser + # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. @@ -71,7 +72,7 @@ config.active_support.deprecation = :notify # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new + config.log_formatter = Logger::Formatter.new # Use a different logger for distributed setups. # require 'syslog/logger' diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 34beba87..0d879a56 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -19,7 +19,8 @@ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. - config.assets.js_compressor = Uglifier.new(harmony: true) + config.assets.js_compressor = :terser + # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. @@ -71,7 +72,7 @@ config.active_support.deprecation = :notify # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new + config.log_formatter = Logger::Formatter.new # Use a different logger for distributed setups. # require 'syslog/logger'