jeudi 9 août 2018

Add preload to a styleseet included in asset-pipeline

I have a page on my website (made on ruby on Rails), for which I want to increase the performance. I am using "Audits" of Google Chrome to test the "Preformance".

One of the things that I am getting in "Opportunities" section are: "Pre-load key requests". What it is telling me is, to use use preload for some of the CSS which are taking time. What I am unable to understand here is that, the CSS that it is telling me to preload is in application.scss file. How do I preload a css which is getting precompiled? Is that even possible?

What I know is that if I am using a stylesheet say, temp.css on a page, I can use 'link rel="preload" href="temp.scss" as="style"' and it will preload the file. Now, how do I do this for an asset which is getting precompiled. I am really confused. Kindly help if my understanding is wrong. Thanks!

Aucun commentaire:

Enregistrer un commentaire