Skip to content

Commit

Permalink
Enable the js_compressor option for Sprockets
Browse files Browse the repository at this point in the history
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
  • Loading branch information
EGiataganas committed Aug 25, 2020
1 parent 9e32deb commit 2e1ca34
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2e1ca34

Please sign in to comment.