Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

HTL add attribute media & onload

iwanttobeDev
Level 2
Level 2

Hello,

 

i want to ask how to add attribute like 'media' & 'onload' on htl

for example: 

 

 

<sly data-sly-use.clientLib="/libs/granite/sightly/templates/clientlib.html" data-sly-call="${clientLib.css @ categories='target.design.all'}"/>

 

 

output :<link rel="stylesheet" href="/etc/designs/target/clientlib-all.min.css" type="text/css">

 

and i trying to get the attribute by adding these following  code inside tag

 

 

<sly data-sly-use.clientLib="/libs/granite/sightly/templates/clientlib.html" data-sly-call="${clientLib.css @ categories='target.design.all'}" media="none" onload="if(media!='all')media='all'"/>

 

 

output:  <link rel="stylesheet" href="/etc/designs/target/clientlib-all.min.css" type="text/css">

what i wanted is 

<link rel="stylesheet" href="/etc/designs/target/clientlib-all.min.css" type="text/css" media="none" onload="if(media!='all')media='all'>

 


please your answer will be greatly help. Thanks in advance,

 

Regards

1 Accepted Solution
Jörg_Hoh
Correct answer by
Employee
Employee

Hi,

this is actually invoking a code snippet provided by AEM, and it does not care about any other provided attribute.

You can check the wcm.io extension to this snippet and see if it fits your requirement: https://wcm.io/wcm/ui/clientlibs/

 

Jörg

View solution in original post

1 Reply
Jörg_Hoh
Correct answer by
Employee
Employee

Hi,

this is actually invoking a code snippet provided by AEM, and it does not care about any other provided attribute.

You can check the wcm.io extension to this snippet and see if it fits your requirement: https://wcm.io/wcm/ui/clientlibs/

 

Jörg

View solution in original post