You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently Sling Model that used to collect and include client libraries allows to add the onload attribute only to the javascript script tag. It would be useful to be able to add this attribute to the stylesheet link tag as well.
In my personal case I'm going to use this attribute to implement loading of non-critical css in a non-blocking way, but I think this attribute can also be useful in some other cases.
Solution
Add the onload attribute for css here: com.adobe.cq.wcm.core.components.internal.models.v1.ClientLibrariesImpl.
Example of usage <sly data-sly-use.clientlibs="${'com.adobe.cq.wcm.core.components.models.ClientLibraries' @ categories='wknd.base', media='print' onloadCss='this.media=\'all\''}"> ${clientlibs.cssIncludes @ context="unsafe"} </sly>
Result <link rel="stylesheet" href="style.css" media="print" onload="this.media='all'">
The text was updated successfully, but these errors were encountered:
…stylesheet link tag (#2296)
* [ClientLibraries] Add option to inject the onload attribute into the stylesheet link tag
* [ClientLibraries] Inject existing onload attribute into the stylesheet link tag
Fixes#2295
…stylesheet link tag (#2296)
* [ClientLibraries] Add option to inject the onload attribute into the stylesheet link tag
* [ClientLibraries] Inject existing onload attribute into the stylesheet link tag
Fixes#2295
…nto the stylesheet link tag (#2692)
* Add option to inject the onload attribute into the stylesheet link tag
* Inject existing onload attribute into the stylesheet link tag
* fixed ITs
---------
Co-authored-by: korben-ne-dallas <alexvedenov@gmail.com>
Co-authored-by: Levente Sántha <levente@adobe.com>
Feature Request
Currently Sling Model that used to collect and include client libraries allows to add the onload attribute only to the javascript script tag. It would be useful to be able to add this attribute to the stylesheet link tag as well.
In my personal case I'm going to use this attribute to implement loading of non-critical css in a non-blocking way, but I think this attribute can also be useful in some other cases.
Solution
Add the onload attribute for css here: com.adobe.cq.wcm.core.components.internal.models.v1.ClientLibrariesImpl.
Example of usage
<sly data-sly-use.clientlibs="${'com.adobe.cq.wcm.core.components.models.ClientLibraries' @ categories='wknd.base', media='print' onloadCss='this.media=\'all\''}">
${clientlibs.cssIncludes @ context="unsafe"}
</sly>
Result
<link rel="stylesheet" href="style.css" media="print" onload="this.media='all'">
The text was updated successfully, but these errors were encountered: