[JIRA] (WWCM-18) Clientlibs UI Extension | JS and CSS scripts are included multiple times

3 views
Skip to first unread message

nimish kumar (JIRA)

unread,
Mar 9, 2022, 9:46:26 AM3/9/22
to wcm-i...@googlegroups.com
nimish kumar created WWCM-18:
--------------------------------

Summary: Clientlibs UI Extension | JS and CSS scripts are included multiple times
Key: WWCM-18
URL: https://wcm-io.atlassian.net/browse/WWCM-18
Project: wcm.io WCM
Issue Type: Improvement
Components: UI Granite
Reporter: nimish kumar


I am using the [https://wcm.io/wcm/ui/clientlibs/usage.html|https://wcm.io/wcm/ui/clientlibs/usage.html|smart-link] client-lib template. The clientlib is included as part of component. If the component is present thrice on the page then I could see the JS and CSS files are included thrice.
Can we add some checks like to include js and css files only once ?



--
This message was sent by Atlassian Jira
(v1001.0.0-SNAPSHOT#100196)

Stefan Seifert (JIRA)

unread,
Mar 9, 2022, 11:18:00 AM3/9/22
to wcm-i...@googlegroups.com

[ https://wcm-io.atlassian.net/browse/WWCM-18?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21482#comment-21482 ]

Stefan Seifert commented on WWCM-18:
------------------------------------

we are using the same pattern as {{ /libs/granite/sightly/templates/clientlib.html }} from AEM itself which just includes the client libraries without checking for multiple occurrences. although it would be technically possible to implement such a behavior with workarounds like request attributes i would propose to follow the usual pattern in AEM: do not declare clientlibs within component which are used in containers. instead, declare client categories which ensure the required client libraries are included in the page where the components are used. this concept is not very elegant, but that’s what is given to us by Adobe.

> Clientlibs UI Extension | JS and CSS scripts are included multiple times
> ------------------------------------------------------------------------
>
> Key: WWCM-18
> URL: https://wcm-io.atlassian.net/browse/WWCM-18
> Project: wcm.io WCM
> Issue Type: Improvement
> Components: UI Granite
> Reporter: nimish kumar
> Labels: granite, ui

nimish kumar (JIRA)

unread,
Mar 14, 2022, 4:04:08 AM3/14/22
to wcm-i...@googlegroups.com

[ https://wcm-io.atlassian.net/browse/WWCM-18?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21488#comment-21488 ]

nimish kumar commented on WWCM-18:
----------------------------------

Hi Stefan,
Thank you for the update. If we use the Adobe concept then we may end up in having scripts which are not needed for the page. The modern browsers are smart to load the js only once but there might be issues in the execution depending on the script content.
I think it is a good feature to add.

> Clientlibs UI Extension | JS and CSS scripts are included multiple times
> ------------------------------------------------------------------------
>
> Key: WWCM-18
> URL: https://wcm-io.atlassian.net/browse/WWCM-18
> Project: wcm.io WCM
> Issue Type: Improvement
> Components: UI Granite
> Reporter: nimish kumar
> Labels: granite, ui
>
> I am using the [https://wcm.io/wcm/ui/clientlibs/usage.html|https://wcm.io/wcm/ui/clientlibs/usage.html|smart-link] client-lib template. The clientlib is included as part of component. If the component is present thrice on the page then I could see the JS and CSS files are included thrice.
> Can we add some checks like to include js and css files only once ?



--
This message was sent by Atlassian Jira
(v1001.0.0-SNAPSHOT#100197)

Stefan Seifert (JIRA)

unread,
Sep 16, 2024, 5:35:35 AM9/16/24
to wcm-i...@googlegroups.com
[ https://wcm-io.atlassian.net/browse/WWCM-18?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Seifert closed WWCM-18.
------------------------------
Assignee: Stefan Seifert (was: Unassigned)
Resolution: Fixed

this issue somehow got overlooked - please note that it’s now fixed with https://github.com/wcm-io/io.wcm.wcm.ui.clientlibs/pull/5 and part of release 1.4.0

> Clientlibs UI Extension | JS and CSS scripts are included multiple times
> ------------------------------------------------------------------------
>
> Key: WWCM-18
> URL: https://wcm-io.atlassian.net/browse/WWCM-18
> Project: wcm.io WCM
> Issue Type: Improvement
> Components: UI Granite
> Reporter: nimish kumar

> Assignee: Stefan Seifert


> Labels: granite, ui
>
> I am using the [https://wcm.io/wcm/ui/clientlibs/usage.html|https://wcm.io/wcm/ui/clientlibs/usage.html|smart-link] client-lib template. The clientlib is included as part of component. If the component is present thrice on the page then I could see the JS and CSS files are included thrice.
> Can we add some checks like to include js and css files only once ?

--
This message was sent by Atlassian Jira

Manage notifications: https://wcm-io.atlassian.net/jira/settings/personal/notifications?emailPreferences=true#emailpreferences
(v1001.0.0-SNAPSHOT#100266)

Reply all
Reply to author
Forward
0 new messages