Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting additional (data-)attributes on the rendered script/link tag #1

Closed
henrykuijpers opened this issue Jul 7, 2023 · 3 comments · Fixed by #2
Closed

Setting additional (data-)attributes on the rendered script/link tag #1

henrykuijpers opened this issue Jul 7, 2023 · 3 comments · Fixed by #2

Comments

@henrykuijpers
Copy link

It would be nice to be able to set additional attributes on the rendered script/link tags.

In our case, we want to specify "rel" and "title", and also "data-contrast" to indicate that our stylesheet is for the contrast option.

It would be good to change the HTL helper, for example by allowing the specification of a map (or similar), so that any attributes can be specified and we don't have to deal with a hardcoded list of supported attributes. This way, we don't have to do code changes when something new needs to be supported.

@stefanseifert
Copy link
Member

i've a proposal in #2 - can you give it a try?

<sly data-sly-use.clientlib="/apps/wcm-io/wcm/ui/clientlibs/sightly/templates/clientlib.html"
    data-sly-call="${clientlib.css @ categories=['my-clientlib-category'],
    customAttributes=['attr1=value 1','data-attr2=5','attr3']}"/>
<sly data-sly-use.clientlib="/apps/wcm-io/wcm/ui/clientlibs/sightly/templates/clientlib.html"
    data-sly-call="${clientlib.js @ categories=['my-clientlib-category'],
    customAttributes=['attr1=value 1','data-attr2=5','attr3']}"/>

@stefanseifert
Copy link
Member

@henrykuijpers is this still relevant? can you have a look at the PR?

@henrykuijpers
Copy link
Author

Oops! totally forgot about this one. Yes, this is still relevant. :) I'll review the PR. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants