HubSpot Ideas

John

Add css async option to module's meta.json file

It would be amazing to have an async argument in modules. Maybe in meta.json?


I saw in the require_css function there is now an { async: true } argument and that would be helpful for a footer module’s css to load asynchronously, for example. 

Mises à jour HubSpot
July 20, 2022 11:08 AM

Hi,

 

This option is available via the meta.json for the module. See https://developers.hubspot.com/docs/cms/building-blocks/modules/configuration#meta-json

 

Thanks,
Matt

6 Commentaires
Sjardo
Contributeur de premier rang | Partenaire solutions Elite

If we can simply get an option where you can set if you want to defer CSS and JS of the module, that would be great! This way we can simply tell each module what to do with the css.

 

A second step would be reading what module is just on the top XXX pixels of the page and defer everything else (with overwrite option if nessesary) .

 

Design_Manager___HubSpot.png

BenjaminRazi
Participant | Partenaire solutions Gold

In most cases, if we want to improve page speed, we need to keep CSS and JS in separate files to access async and defer parameters. But, unfortunately, that forces us to miss out on the enormous value of keeping everything (HTML, CSS, JS) organized in the module.

 

This is critical to be 'compliant' with Google's Core Web Vitals.

ANelson5
Membre

Agreed on this being critical to Google's Core Web Vitals.  I'm in the process of preparing a client's new site for launch soon and am noticing this exact limitation.  I tried a hacky approach that seemed to pass the Core Vital test that was failing, but is FAR from adequate:

  1. Removed any\all CSS in my Coded Modules and stuck them in my global level CSS file
  2. Unlinked the CSS's that I was referencing in my template and added them as <link>'s in the 'Additional markup before </body>' area
  3. Cloned my Drag\Drop page template as HTML and removed the reference to the default layout.css

As I mentioned, I got around the test that was failing, but I've had to fallback on on terrible web development practices to do so.  I'm hoping Hubspot can add this quickly.

SJaeger
Contributeur | Partenaire solutions Platinum

we urgently need this function. google page speed is only at 86. there is still a little more to go up 🙂

mcoley
Équipe de développement de HubSpot

Hi,

 

This option is available via the meta.json for the module. See https://developers.hubspot.com/docs/cms/building-blocks/modules/configuration#meta-json

 

Thanks,
Matt

Jake_Lett
Guide | Partenaire solutions

Thank you for adding this option.