Clientlib - CSS includes | Community
Skip to main content
New Participant
Dec 6, 2017 3:54 PM UTC
Solved

Clientlib - CSS includes

Is it possible to use lazyload css using clientlib. In general, there are multiple ways like using aync, media as "dummy" value, prefetch etc., but I am not sure if clientlibs support anyone of these. Please suggest.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
edubey
edubeyAccepted solution
Level 10
Dec 7, 2017 5:23 AM UTC

If you want this feature from OOTB AEM? - Not supported

But you can follow approach mentioned here for these attributes

GitHub - nateyolles/aem-clientlib-async: Create AEM clientlibs that can output 'async', 'defer' and 'onload' attributes …

https://github.com/nateyolles/aem-clientlib-async

5 replies

edubey
edubeyAccepted solution
Level 10
Dec 7, 2017 5:23 AM UTC

If you want this feature from OOTB AEM? - Not supported

But you can follow approach mentioned here for these attributes

GitHub - nateyolles/aem-clientlib-async: Create AEM clientlibs that can output 'async', 'defer' and 'onload' attributes …

https://github.com/nateyolles/aem-clientlib-async

Translate
smacdonald2008
Level 10
Dec 6, 2017 10:20 PM UTC

A workaround is to load CSS in this manner is implement a solution like you would in a non-AEM web app - javascript - Lazy load of css file - Stack Overflow

I have never tried this - but AEM is a web app and you can still use JS, etc.

Translate
smacdonald2008
Level 10
Dec 6, 2017 10:15 PM UTC

I do not think so -- read best practices with clientlibs -- Using Client-Side Libraries

Translate
New Participant
Dec 6, 2017 6:04 PM UTC

I meant lazyloading the stylesheet using async, media or prefetch attribute.

Translate
smacdonald2008
Level 10
Dec 6, 2017 4:21 PM UTC

From all my experience with CSS and Clientlibs - the CSS styles are picked up when the page loads.

Translate