Skip to content

Commit

Permalink
Precompile on start when running dev server with ASSETS_COMPILED_LIKE…
Browse files Browse the repository at this point in the history
…_IN_PROD set
  • Loading branch information
DanielJackson-Oslo committed Jan 30, 2024
1 parent 1238d0c commit 2279400
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
Rails.application.configure do # rubocop:disable Metrics/BlockLength
# Settings specified here will take precedence over those in config/application.rb.

# Pass in an env variable ASSETS_COMPILED_LIKE_IN_PROD
# to test without assets compiled, like in prod.
# You then need to run
# - yarn build
# - yarn build:css
# - rails assets:precompile
# to get the assets ready before booting the app.
# Pass in an env variable ASSETS_COMPILED_LIKE_IN_PROD=true
# to test with assets precompiled, like in prod.
# This will also run the precompilation for you
# on first boot. NB: This way, you might have to
# manually precompile assets to see changes made
# after the app was booted.
if ENV["ASSETS_COMPILED_LIKE_IN_PROD"].present?
config.assets.compile = false
config.serve_static_files = true
system("rake precompile_assets_once")
end

# If we precompile in dev, we want it in it's own folder - not mixed with test or prod assets
Expand Down

0 comments on commit 2279400

Please sign in to comment.