Skip to content

Commit 8b0f247

Browse files
committed
Do not compile assets in production
We're seeing the following warning in deployments like this one [1]: You set your `config.assets.compile = true` in production. This can negatively impact the performance of your application. For more information can be found in this article: https://devcenter.heroku.com/articles/rails-asset-pipeline#compile-set-to-true-in-production Heroku is automatically running `rake assets:precompile` and `rake assets:clean` (which just removes old versions of assets) as part of the build step and the build will fail if either of these tasks fails. So we should be able to rely on precompiled assets being present and thus we should be able to set `config.assets.compile` in the Rails production environment. [1]: https://dashboard.heroku.com/apps/editor-api-staging/activity/builds/f9360560-9d26-487b-8258-cf84906055bf
1 parent a00ca85 commit 8b0f247

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

config/environments/production.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
# Apache or NGINX already handles this.
2727
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
2828

29+
# Do not fallback to assets pipeline if a precompiled asset is missed.
30+
config.assets.compile = false
31+
2932
# Specifies the header that your server uses for sending files.
3033
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
3134
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX

0 commit comments

Comments
 (0)