screen flashing with SASS
I recently installed the sass gem for Rails 3. The screen now flashes text (too quick to actually tell what it is) each time a page is viewed. I can't tell if it is the actual sass text or if it is the text of the site without any css styling. The issue does not reoccur if I return to the page, it only happ开发者_开发百科ens the first time the page is viewed.
I am using a lot of @import's in my scss files, could several layers of @import's cause this? Any other clues what might cause this?
Make sure you load your stylesheets before you load javascript (by putting the link statements before the script statements), since browsers tend to block on the loading of javascript files which maybe why briefly you see the unstyled content of your page.
Also, if this occurs only in development mode, then it indeed might be caused by the longer render time of your scss files. The generated CSS is cached when your application is in production mode, so it's not really an issue then.
Kind of a weird problem. Maybe you can start removing each import file and refreshing the page to try to isolate which scss file might be causing it. If you have more than 20, I'd say start by removing half, then another half, so on and so forth. Hope it helps.
精彩评论