Question: Fill in the blank. Defer loading of non-critical CSS by adding ______ as an argument in your require_css function call.
- { defer: true }
- { position: footer }
- { type: defer }
- { async: true }
Explanation
In HubSpot, require_css supports an async option for loading non-critical styles asynchronously, which is the documented technique used when separating critical CSS from deferred styles. The HubSpot developer changelog explicitly states that require_css was updated to support asynchronous CSS loading. The HubL function reference also notes that require_css supports async (true/false) as an option. Because the blank asks for the argument added to the function call, the correct choice is the one that matches that documented option. HubSpot Developers+1
Why the other options are incorrect
A) { defer: true } is not the documented option for require_css, because HubSpot documents async support for CSS loading instead. HubSpot Developers+1
B) { position: footer } applies to script placement patterns, not to deferring non-critical CSS in require_css. HubSpot Developers+1
C) { type: defer } is not the HubSpot-documented argument format for asynchronous CSS loading. HubSpot Developers+1
Source for verification
https://developers.hubspot.com/docs/cms/reference/hubl/functions
https://developers.hubspot.com/changelog/hubl-updates-for-speed-enhancement
The answer(s) to the question is highlighted in the BOLD text above. You can also find more questions and answers related to the exams on the "HubSpot CMS for Developers II" page.
