From 2e1ca341b316a201159bcfd30bdb0c127f79a001 Mon Sep 17 00:00:00 2001 From: Evangelos Giataganas Date: Tue, 25 Aug 2020 11:26:27 +0100 Subject: [PATCH] Enable the js_compressor option for Sprockets Because the default for Rails 6 is to use webpack for JS the Sprockets js_compressor option is not set in the generated production.rb environment file. This leads to bloated file sizes in production so re-enable compression by explicitly setting it --- config/environments/production.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/environments/production.rb b/config/environments/production.rb index dc3bab9a2..d12b86a27 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -22,6 +22,9 @@ # Apache or NGINX already handles this. config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? + # Compress JS using a preprocessor. + config.assets.js_compressor = :uglifier + # Compress CSS using a preprocessor. # config.assets.css_compressor = :sass