CMS Development

ashu125
Teilnehmer/-in

How to defer linked CSS

lösung

Hi there, can someone please tell me how to defer a CSS file that's linked to a Template.

0 Upvotes
2 Akzeptierte Lösungen
ashu125
Lösung
Teilnehmer/-in

How to defer linked CSS

lösung

But the problem is that I am not requiring the css file, I am injecting the css to a template

 

img_20220710_456897.png 

 

Lösung in ursprünglichem Beitrag anzeigen

0 Upvotes
KSchuller
Lösung
Teilnehmer/-in | Elite Partner
Teilnehmer/-in | Elite Partner

How to defer linked CSS

lösung

@ashu125 you can simply unlink the css file there and then include it in the markup.

 

If you want more control over linked files you will need to HubSpot CLI and edit the module's meta.json file and use css_render_options -- you can find more details here https://developers.hubspot.com/docs/cms/building-blocks/modules/files

Lösung in ursprünglichem Beitrag anzeigen

4 Antworten
KSchuller
Teilnehmer/-in | Elite Partner
Teilnehmer/-in | Elite Partner

How to defer linked CSS

lösung

Refer to this https://developers.hubspot.com/docs/cms/hubl/functions#require-css you will see there you can async a CSS file in the following way:

{{ require_css(get_asset_url("./style.css"), { async: true }) }}
0 Upvotes
ashu125
Lösung
Teilnehmer/-in

How to defer linked CSS

lösung

But the problem is that I am not requiring the css file, I am injecting the css to a template

 

img_20220710_456897.png 

 

0 Upvotes
KSchuller
Lösung
Teilnehmer/-in | Elite Partner
Teilnehmer/-in | Elite Partner

How to defer linked CSS

lösung

@ashu125 you can simply unlink the css file there and then include it in the markup.

 

If you want more control over linked files you will need to HubSpot CLI and edit the module's meta.json file and use css_render_options -- you can find more details here https://developers.hubspot.com/docs/cms/building-blocks/modules/files

ashu125
Teilnehmer/-in

How to defer linked CSS

lösung

Yeah, I can do that. Thanks a lot

 

0 Upvotes