Everything was working fine on my app, after I overhauled the entire front-end design. I attempted to push to my staging server on heroku, and I was getting issues when it was precompiling my assets. So, I attempted rake assets:clobber && rake assets:precompile, and now none of the css is loading in development at all. Syntax errors in my application.sass to bring up error pages, but it's not loading any of the css in my app. In chrome dev tools the only css files showing are SweetAlert css files.
I found the answer. I thought you had to precompile your assets in development, but after some research I found you do not. I clobbered my assets with rake assets:clobber and my css began loading just fine again. Also when pushing to heroku I did nothing else, since heroku precompiles your assets on deployment
Related
After compiling assets in production, old assets are displayed instead of new assets. Moreover, the compilation was successful and the file with the new assets is present on the server. I tried running rake assets:clean, it didn't help.
What could be the problem and how can it be solved?
I tried running rake assets:clean, it didn't help.
I have been building a Rails application that I am deploying to Heroku, I had installed a navbar to navigate around the app and it was working completely fine until recently. Now the navbar is not showing up on the application even though it still works perfectly when I try anything locally. I have tried rake assets:precompile, bundle install, and all the usual suspects. I don't know what to do exactly. I have attached screenshots of my app in testing and production. This is the image of the two apps. This error first turned up when I created an account on the production application on Heroku. The logs show this error
ActionController::RoutingError (No route matches [GET] "/assets/~bootstrap/scss/bootstrap")
So if a public/assets/manifest.yml(Rails 4 uses a file called public/assets/manifest-.json instead) is detected in your app, Heroku assumed you are handling asset compilation yourself and will not attempt to compile your assets. On both versions you can generate this file by running $ rake assets:precompile locally and checking the resultant files into Git.
This means that I ran rake assets:precompile locally, even just once, and then checked in that manifest file that would then need to run assets:precompile and check the results into git before every deploy. It's quite a subtle change that can catch people out.
Removing the public/assets/manifest.yml file from my git repo and re-deploying the app, so that asset compilation is done automatically by Heroku again solved the error.
If I make a change to application.css.scss, no changes are reflected unless I do rake assets:precompile. However, when I run that, none of the JavaScript in my application works. At that point, I have no way of getting the JavaScript to work unless I re-clone the application from GitHub (which wipes out my CSS changes of course). This is all on a local development environment. Any ideas as to why?
Running in development environment should not use precompiled assets unless you've previously precompiled them.
Clean them up with rake assets:clobber and it should pick up your assets as opposed to the precompiled ones.
i built a small rails application and pushed it to heroku.
everything seem to be working fine. except the styling i gave to views through the sepcific file css generated for each controller. in: app/assests/stylesheets for example:
main.css.scss
which has this code in it:
.login_form {max-width:455px;}
is not loading in view in my
main_controller
only application.css is loading
what do i need to configure?
thanks
It may be that you need to precompile your assets.
bundle exec rake assets:precompile:all RAILS_GROUPS=assets
Read up on the Rails Guides Asset Pipeline.
That would explain why it worked in development, but the production environment is set to expect to use precompiled assets.
I'm getting the typical error on Heroku, that it appears the solution is to precompile locally and then commit to git.
ActionView::Template::Error (application.css isn't precompiled)
However I have my assets on Rackspace CloudFiles CDN using asset_sync and they are compiled fine, so I don't really want to also have to commit the compiled assets to git.
Any solution?
before you push your app to heroku run the following.
bundle exec rake assets:precompile
That will precompile all the necessary javascript and css.
If you are running the app on your computer after you precompile you will not see any css and js changes until you run.
bundle exec rake assets:clean
that will remove all precompiled files, you need to precompile every time you push your app.