I have a basic Rails app built using Suspenders. One of my pages is a form that I have not added any styling to, just what comes from _forms.scss. In dev the form has the basic styling I would expect. However, after I deployed to Heroku the form lacks all styling and has the form elements all on the same line.
Are there extra setup steps to get Bourbon / Neat / Bitters to work correctly after being deployed to Heroku?
I meant manually precompiling. Not sure if it will have any effect for you but I can never get my css working right on Heroku until I precompile it myself.
Do you get any warnings when deploying to Heroku? Specifically this one:
WARNING: Include ârails_12factorâ gem to enable all platform features
The two pieces I can think of is not having the rails_12factor gem installed or setting the following config setting in your config/environments/production.rb file.
config.serve_static_files = true
The gem just does the above configuration for you (along with other things that you can also manually configure).
@analyticspierce Since youâve generated the app with Suspenders, Iâd check if the ASSET_HOST env var is correctly set as well as setting RAILS_SERVE_STATIC_FILES to true.
I donât use Heroku, but just because the rake task for precompiling assets runs doesnât necessarily mean all your assets are precompiled. 3.12s sounds a bit too good to me. For me it will usually itâll take up to a minute for an application with a decent amount of asset dependencies (jQuery et al.) on a 1GB digital ocean node.
AFAIK, using the @import SASS directive doesnât actually add anything to your asset manifest. If you want something to be precompiled, youâll need to include it using require ... or require_tree in your application.js/application.css. You can also include the file in application.rb, e.g:
Note that if you add require_tree to your application.js/css, expect the possibility for various JS and CSS conflicts throughout your application. Basically what itâs doing is including all your assets into the file you use it in. So for instance, if you have two different CSS files targeted towards different pages with their own definition of how the body tag is meant to appear then you should expect some conflicts. Further, if you load everything in your application.css/js then youâll need to remove any inline stylesheet_link_tag & javascript_include_tag references besides the ones that are used to load your main manifest files.
Dealing with the asset pipeline in production has been one of the biggest pain points for me in my short Rails career. Remember that Chrome/FF developer consoles and server logs are your best friends in production.
What should the ASSET_HOST env var be set to if my heroku app is serving the assets? Iâve been searching but havenât tracked down the right answer.