Reputation: 5585
My issue is that there are a lot of changes which I did in the app/assets folder so in my development environment I easily undid the old ones with this command.
rake assets:clobber
and then recompiled with this one.
rake assets:precompile --trace
It all works well on my local. Now the issue is that few changes have messed up on heroku. Although heroku precompiles assets while pushing the code on it, I want to precompile the assets manually. When going through the generated application.css it has specified values four times rather than once. First and third time the value is right but the second and fourth is wrong so it is picking up that wrong one I guess. So I want to fix it up by cleaning the assets and precompiling it afresh. Thanx for the help.
Upvotes: 1
Views: 1253
Reputation: 76774
precompile the assets manually
Heroku's ephemeral file system is rebuilt each time you push your code. Thus, in theory (Heroku often has its own way of doing things), your assets will be wiped with each new deploy.
It's a hack, but you can invoke rake tasks off the back of assets:clean
:
# lib/tasks/heroku_migrate.rb
Rake::Task['assets:clean'].enhance do
Rake::Task['assets:clobber'].invoke
...
end
--
In regards to your asset pipeline, if you're getting a particular issue with the way your stylesheets are compiled, it suggests you have an issue with the underlying code/implementation.
Perhaps showing what issue you're getting with that would be beneficial?
-
You can, of course, precompile locally with a simulated production
environment:
rake assets:precompile RAILS_ENV=production
Update
We use the following:
#Gemfile
gem 'font-awesome-rails', '~> 4.5' #-> Icons
#app/assets/stylesheets/application.sass
@import font-awesome
You don't need any more than that if you're using font-awesome
.
Of course, if you're looking to use variables or mixins (we HIGHLY recommend bourbon
), you can use them as you please. You just don't need to add font-awesome
files to your pipeline if you're using the gem.
Upvotes: 1