What's wrong with CSS styles in Rails 3.1? - css

I switched to the Rails 3.1 and found interesting (for me) stuff - when I update something in my application.css, these changes will not be applied after I refresh my browser. And the same with application.js.
How can I get the CSS and JS files to update after I refresh my browser?
Thank you

Sounds like you've run rake assets:precompile, which caches these files in public/assets. Runrake assets:clean` to clear this.
Read the Asset Pipeline guide for more explanation.

Related

Drupal 7 cache & css compression affects sub-domains

There is an issue with caching on my website. I used standard in-build cache and css&js compression previously, but now I had to turn it off. Turns out, all js&css code still minified. What's more - it affects sub-domain folders (my host is bluehost) so all sub-domain are also have same problem with scripts.
It's really weird issue. I tried to clear all cache_ tables from Drupal database, as well as everything related to cache from /sites/ folder. Still no result.
Any help will be appreciated.
Perhaps you have used advagg or minify module for that. If so - you need disable them in order to get rid of minification.
I would also recommend to inspect the current css files in browser and check what is the path to it. Doing that you would get better understanding what is going on here.
After disabling minification options on System/Development/Performance page in the actual html source on a page it should change from
into a list of
#import url("http://domain.name/sites/all/modules/admin_menu/admin_menu.css?nlpz6z");

Vaadin missing icons of all components

We use the Vaadin valo-theme and component icons like the arrow of the combobox or the icon of the datefield are missing. We tried to put font-awesome manually, but the icons are still missing. We can't explain why.
Can somebody help?
My log output is full with stuff like this:
INFORMATION: Requested resource [/VAADIN/themes/valo/fonts/open-sans/OpenSans-Light-webfont.woff] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
I'm not sure if its related to our problem.
Instead of the icons there are just this signs
We changed the Java version of the project form 1.7 to 1.6. That solved the problem.
I just had exactly the same problem.
We are using Wildfly 8.2 to deploy the application. The problem occured by enabling GZip compression for the server (following this blog post: How to enable GZIP compression in Wildfly 8.2).
Disabling it made everything work again. Currently I am still investigating why this is a problem.

Compass Bootstrap CSS cache issue

I'm currently running Compass and Bootstrap 3 through a Vagrant VM Box.
I've managed to successfully setup the project using both the Compass and Bootstrap Gem's.
I've now started writing my styles. Upon save I can see which files have been modified and if a the CSS has been re-compiled through SuperPuTTY, when using compass watch --poll. However, when either compiling via compass watch or through compass compile, I only occasionally see the changes through my browser.
I don't believe this to be a browser caching issue, as I've turned it off via dev tools, I've also tried clearing the cache, as well as directly opening up the newly compiled CSS and adding a ?1234 cache buster to the end of the URL. I'm also getting no errors upon compile (these are also normally displayed within SuperPuTTY).
I have a suspicion the problem may lay in the bootstrap plugin as this require 'bootstrap-sass' is loaded in the config.rb file, I'm currently investigating this.
Is anyone aware of any fixes for this, or aware of any issues/bugs with Compass compiling the Bootstrap SCSS code?
/------ UPDATE ------/
After further investigation this seems to be a caching issue. The file seems to be correct on the server after compiling, but when it arrives at the browser it seems to retain the old version. The browser cache is disabled, this is where my confusion now lays, as it should request a new file upon refresh.
We seemed to have fixed the problem by adding a no-cache rule for our header, and also disabling sendfile in the Apache vhosts file. This combination seems to have resolved the issue

guard live reload not injecting css changes to page. Sinatra app

I have a sinatra app using the rack-livereload and guard-livereload gems.
guard 'livereload' do
watch(%r{views/.+\.(erb|haml|slim)$})
watch(%r{.+\.(css|js)$})
end
When I make changes to my erb files, the browser reloads. It works as expected.
I'm using the sass gem for my css.
When I make changes to my .scss file, the css is not updating. The changes are not visible in the browser until I refresh the page. The sass is working - but is not being picked up by active reload.
Any idea how I set this up?
It looks like it's not reloading because the regex in the watch statement is only looking for files that end with .css or .js. If you want to make sure your .scss files get included, just change the watch statement to this:
watch(%r{.+\.(css|scss|js)$})
Another stylesheet that was missing from the page (404) stopped livereload from working for my case, it wasn't the stylesheet in concern but it prevent livereload from detecting the change in the one that I was making.

Rails Asset Pipeline - CSS Not Updating

I am trying to update the font in a rails app - specifically the text in a brand class in the top navbar. I was successful in changing the font using google web fonts already, but now when I try to update the font again, it seems to be "stuck" on the last font I used. I precompiled assets before deploying to heroku, which is what I think may be causing the problem. Now the changes are not updating locally or in production.
I have done a few things to troubleshoot but none seem to be working:
Restarted the rails server
Emptied the cache folder in the tmp folder
Deleted public assets
Tried precompiling assets again - the font change does not work locally or on heroku
Tried targeting a more specific css selector (.navbar .brand versus .brand - it worked earlier for .brand so don't think that is the issue)
Cleared browsing history
Any ideas on what may be causing this?
Are you using turbolinks? If so, read this
Asset change detection
You can track certain assets, like application.js and application.css,
that you want to ensure are always of the latest version inside a
Turbolinks session. This is done by marking those asset links with
data-turbolinks-track, like so:
<link href="/assets/application-9bd64a86adb3cd9ab3b16e9dca67a33a.css"
rel="stylesheet" type="text/css" data-turbolinks-track>
If those assets change URLs (embed an md5 stamp to ensure this), the
page will do a full reload instead of going through Turbolinks. This
ensures that all Turbolinks sessions will always be running off your
latest JavaScript and CSS.
When this happens, you'll technically be requesting the same page
twice. Once through Turbolinks to detect that the assets changed, and
then again when we do a full redirect to that page.
Stupid mistake - had a navbar class styled in my css with font-style: monospace. After clearing that, everything worked - hopefully the troubleshooting steps help others!
View your page source and search for the font src. If you can't find it skip to 3.
Test the font and display code outside of the rails apps to make sure it is the asset pipeline.
If the src and display code work, provide your application.css and application.js to check your manifests.
What config files/code have you changed since your last assets:precompile that is not working properly.
My similar issue: Bootstrap, jQuery, and the Rails asset pipeline

Resources