Skip to content

Commit

Permalink
feat: Add terser for js compression in production (#1249)
Browse files Browse the repository at this point in the history
  • Loading branch information
julianrubisch authored Jan 2, 2024
1 parent f88e6ba commit ba439f7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ group :production do

# Use S3 for Active Storage by default.
gem "aws-sdk-s3", require: false

gem "terser"
end

# Use Ruby hashes as readonly datasources for ActiveRecord-like models.
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ GEM
erubi (1.12.0)
erubis (2.7.0)
event_stream_parser (1.0.0)
execjs (2.9.1)
extended_email_reply_parser (0.5.1)
activesupport
charlock_holmes
Expand Down Expand Up @@ -644,6 +645,8 @@ GEM
railties (>= 6.0.0)
stringio (3.1.0)
stripe (10.2.0)
terser (1.1.20)
execjs (>= 0.3.0, < 3)
thor (1.3.0)
thread-local (1.1.0)
timeout (0.4.1)
Expand Down Expand Up @@ -755,6 +758,7 @@ DEPENDENCIES
sprockets-rails
standard
stimulus-rails
terser
turbo-rails
tzinfo-data
web-console
Expand Down
3 changes: 3 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
# Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass

# Compress JavaScript
config.assets.js_compressor = :terser

# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false

Expand Down

0 comments on commit ba439f7

Please sign in to comment.