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

HTL add attribute media & onload

Avatar

Avatar
Validate 1
Level 1
iwanttobeDev
Level 1

Likes

2 likes

Total Posts

17 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Applaud 5
Affirm 1
View profile

Avatar
Validate 1
Level 1
iwanttobeDev
Level 1

Likes

2 likes

Total Posts

17 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Applaud 5
Affirm 1
View profile
iwanttobeDev
Level 1

30-06-2020

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,113 likes

Total Posts

3,145 posts

Correct Reply

1,072 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,113 likes

Total Posts

3,145 posts

Correct Reply

1,072 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

10-07-2020

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

Answers (0)