cancel
Showing results for 
Search instead for 
Did you mean: 

How to load CSS with rel="preload" attribute?

How to load CSS with rel="preload" attribute?

Hello, i have imported my css file like this in layout: 

<css src="Mymodule_CustomModule::css/slick.css" />

 but i want it to add rel="preload" attribute too, is it possible in magento 2? i searched everywhere but didn't found any solution :/

1 REPLY 1

Re: How to load CSS with rel="preload" attribute?

As of Magento 2.3.3 this can be achieved with the <font> head type.
Documentation: https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/css-topics/using-fonts.html#font-head-typ...

Reference implementation (from Luma):

https://github.com/magento/magento2/blob/2.3.6/app/design/frontend/Magento/luma/Magento_Theme/layout...5

If issue solved, Click Kudos & Accept as Solution.
LitCommerce - The Most Simple & Affordable Multi-channel Selling Tool