Friday, 13 November 2015

How to include clientlibs in you component using Sightly AEM

How to use client libs in Sightly


First you should declare data-sly-use.clientlibInclude in your .html file

<div data-sly-use.clientlibInclude="${'/libs/granite/sightly/templates/clientlib.html'}"></div>

how to  include only CSS of clientlib 

<output data-sly-call="${clientlibInclude.css @ categories='clientlib1,clientlib2'}" data-sly-unwrap/>

how to  include only JS of clientlib 

<output data-sly-call="${clientlibInclude.js @ categories='clientlib1,clientlib2'}" data-sly-unwrap />

how to  include both CSS and JS of clientlib 

<output data-sly-call="${clientlibInclude.all @ categories='clientlib1,clientlib2'}" data-sly-unwrap />

1 comment :

  1. How is it possible to read such a clientlib include from OSGI. If I try to read a clientLib file which is combined from multiple files in OSGI, it gives FileNotFound exception

    ReplyDelete