I notice there is a weird thing going on in rails 4.2.0. I am using the default dev environment. When I change some of my JS files, the fingerprint does not change and it keeps serving the old file. The weird thing is that this does not happen to all my JS/CSS files. I tried rebooting my machine and restarting rails server. None of them worked. Renaming the file works, but when I rename it back to the old one, it starts serving the old version again. Anyone has an idea why?
Make sure to set config.serve_static_files = false in your config/environments/development.rb and to reset your browser cache.
I am not sure if we have the same situation, but hopefully this helps.
Reference
I was using a custom application-all.scss instead of the normal application.scss stylesheet in which application-all.scss used to be part of Rails.application.config.assets.precompile.
I renamed application-all.scss into the digested-name application.scss, and updated related code.
After that, it worked now for me.
Related
I'm using parsley.js in a rails project and it works perfectly fine on my local machine. On Heroku, it's as if it's not there. The javascript file is in app/assets. I looked at the compiled js that is served on heroku and parsley is definitely in there, but I'm not seeing it actually working.
I'm not even sure how to start troubleshooting this. What could be the issue?
I have the same problem before. But I make some changes in enviroments/production.rb file. First, try to add this line:
config.assets.compile = true
This should be enough. But if you hold your asset files in special locations, you may also add the line like this: config.assets.precompile += %w(ckeditor/*), where you should specify your locations.
This is way beyond my knowledge..
I was migrating my rails 3 application from Bootstrap 2 to Bootstrap 3. I downloaded Bootstrap 3 and FontAwesome, put them into my assets folder. Then I tried to modify the font path. I change #FontAwesomePath in font-awesome/variables.less several times, however it still don't points to the correct path. (I put font files in ./app/assets/fonts/font-awesome/)
#FontAwesomePath: "fonts/font-awesome"
It's ok, cuz I saw the line below this one is a cdn path to font files:
//#FontAwesomePath: "//netdna.bootstrapcdn.com/font-awesome/3.2.1/font"; // for referencing Bootstrap CDN font files directly
I uncomment this line, everything seems fine. The compiled css file load the font from cdn and all icons are displaying.
Then I delete this line, try to point #FontAwesomePath back to local server again. STRANGE thing happened! No matter what I did, the compiled css file points it to the CDN path! I tried to clear browser cache, reboot rails server (I was using development mode of rails server), even to load the website from other computers, nothing changes. It insisting point #FontAwesomePath to the CDN path even no where in the whole application code exists the url! I can only image there is some kind of variable cache in less compiler. Can anybody tell me what's happened inside this? It's driven me crazy.
edit: I'm using less gem (v 2.3.2), which includes lesscss v 1.3.3.
I had issues with CSS updates, these where only solved by going to tmp > cache and deleting the assets folder then restarting the server. The CSS was then updated.
Hope this helps.
Steph
Going nuts here. I'm developing a rails app, and I'm using the twitter-bootstrap-rails gem in order to include the Twitter Bootstrap styles in my app. This gem generates a file called 'bootstrap_and_overrides.css.less' in app/assets/stylesheets, which I have been using to modify some of the bootstrap variables and include my own CSS overrides.
Everything has been working fine until today. For some reason, the changes I am making to this file today are getting saved to the file, but Rails is still serving the old version of the file! I've searched and found no precompiled versions of the file anywhere (nothing in public/assets)...only the one in assets/stylesheets which I have been modifying. Everything looks fine as far as the directories within the app go, but then when I start the rails server, load the page, and use the element inspector to look at the stylesheets, it's using an old version of 'bootstrap_and_overrides.css.less' with rules that I have deleted. I've turned of the cache in my browser, and tried it in 4 different browsers too, so I'm pretty sure this isn't a result of browser caching.
The rails asset pipeline just seems to serving a version of the file that doesn't exist! Does anybody have any ideas why this might be happening?
Fixed it.
The asset pipeline was storing a cached version in tmp/cache.
I ran rake tmp:clear, which deleted all the files in there, and then rails served the version of *bootstrap_and_overrides.css.less* that I wanted.
Why the cached version suddenly stopped getting updated is beyond me. Arrghhhh!
I am quite new with Rails and I am having some irritating problems with caching of css files.
I have a .css.less file with imports inside it. It's the only stylesheet the app includes, so the other files get imported only once and by this unique stylesheet.
One of those imported .css.less stylesheets seems to be cached somewhere, because does not change in the browser when I change it's source.
I can only see the changes I made if I change something in the root stylesheet.
I have the server in development mode, so the caching should be off. I have also used <%= stylesheet_include_tag "style", :cache => false %>
I tried with Chrome and Firefox, with and without clearing their cache too. Always the same result, if I work only on that file the css the page receives when reloaded doesn't have the changes...
I also stopped the server and rm everything in the tmp folder of the app. No changes.
I am using Rails 3.1 with Ruby 1.9.3, with the less-bootstrap-rails gem. Both the root stylesheet and the imported one have .css.less extension.
What am I missing?
Thank you!
This is an area where I think the asset pipeline is broken, but I don't think there's a good fix.
If I remember correctly, to get changes in files you've included/required in your .css.less file, you need to change the .css.less file itself.
I had this on Rails 4.0.8, infuriating. The config changes mentioned above didn't help. Here's what seems to have fixed it for me:
Ensure NO FILES share a base name. For example, you have a reports.css.less and a reports.js.coffee? Doesn't matter if they're in the same directory or not. Rename or delete one of them. (I changed it to reports-styles.css.less).
Blow away your cache: rm -rf tmp/cache
Restart your Rails app.
This appears to be a decent fix but, since I don't know what's actually going on, this could be totally false and it's just working by coincidence now. Sorry this answer isn't more rigorous!
I've just came across the exact same problem.
I found that if you rename your *.css.less file (the one with the imports inside) to *.less, then this weird cacheing problem gets resolved.
Add this to your config/application.rb
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
See more at: Ruby on Rails Guide: Asset Pipeline
I am trying to modify javascript files in a Ruby on Rails application in HEROKU. Every time I modified something, it did not have any effect on the application. Thanks to a member in this web site, I realized that my application is using asset packager. This asset packager creates a file called base_packaged.js that has all the javascript file compressed.
Because I am new with Heroku and using Windows I modify everything with a text editor, in this case I use notepad++. So when I change the file for example quote.js, nothing happens. I suppose The file quote.js is changed but the compressed base_packaged.js is not been updated. So when I push the file using GIT GUI to Heroku, only the file quote.js is updated but heroku does not recognized that change and does not modify the base_package.js.
How can I modify edit or update the base_package.js. Obviously file is very important I don't want to make a mess with my application.
Thank you.
Ok, so this is surely a suboptimal solution but I have had the same exact problem and this is what I have done. Go into any file such as your rake file in your public directory and just add something to a comment or add another comment.
Git will see this change and your other changes will get added along. I completely understand that this is a hack but It is super easy you works!