Clientlib - CSS includes | Community
Skip to main content
New Participant
December 6, 2017
Solved

Clientlib - CSS includes

  • December 6, 2017
  • 5 replies
  • 1840 views

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.
Best answer by edubey

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
New Participant
December 7, 2017

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

smacdonald2008
New Participant
December 6, 2017

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.

smacdonald2008
New Participant
December 6, 2017

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

New Participant
December 6, 2017

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

smacdonald2008
New Participant
December 6, 2017

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