Solved!! Asset was not declared to be precompiled in production. Ruby on Rails Development.

When developing using Ruby on Rails, and you try to add Bootstrap to an already existing application. One of the best choice will be to include bootstrap to only few pages because you don't want to change the look and feel of a huge application. However, the problem might arise when you create a custom application.scss file and try to @import bootstrap installed as a gem.

Error: Asset was not declared to be precompiled in production

Solution: Navigate to config/initializers/assets.rb and include "Rails.application.config.assets.precompiled += %w(NameOfYourCustomBootstrap.css)

Explainer: What this entails is that, when the Rails application compiles on runtime, the engine compiles all scss or sass files into css, however, when you created a custom scss file to hold Bootstrap, the application got confused because you didn't define a name of a css file to compile all the bootstrap scss content to. Hope this helps to solve your problem.


© 2024 - ErnesTech - Privacy
E-Commerce Return Policy