Precompiling Rails assets for production

Written on June 3, 2019

If you’re deploying your Rails application to a production environment, it’s ideal to precompile your assets. To do this, you’ll want to run,

RAILS_ENV=production rails assets:precompile

RAILS_ENV=production tells Rails to compile the production version of the assets.

assets:precompile is a Rails provided rake task that has instructions for compiling the assets.

Stay in touch

Thanks for reading this article. I'd love to stay in touch and share more tips on programming and side projects with you. Sign up and I'll send you my articles straight to your email, you'll also get a free copy of the light themed version of my Git cheat sheet.
Git cheat sheet preview image