开发者

screen flashing with SASS

开发者 https://www.devze.com 2023-03-18 10:47 出处:网络
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 t

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消