Hi,
I have added clientlibs in the Experience fragment template and created an Experience fragment from it. When I use this Experience fragment on the page, the clientlibs defined in the Experience fragment template are not loading on the page. Is there a way to load them?
Thanks!
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Madhur-Madan
I think you should include all your clientlibs(site CSS/JS) in the site clientlibs and load on Experience fragment editor as well rather than doing other way.
overlaying XF and loading clientlibs for XF can result in loading multiple clientlibs(more network call) even worse if more than one instance of XF is added on page.
Hi @mvelicheti,
You can follow the steps below:
Step 1: Go to the experience fragment. Click on the 'Page Info' icon on the top left. Select "Edit template".
Step 2: Click on the 'Page Info' icon on the top left and select Page policy
Step 3: Add your custom clientlibs and create a new Policy. I have added 'yourproject.test' and named the policy 'Test Policy'
Step 4: Create a clientlib folder under 'apps/yourproject/clientlibs' and provide the same category as added in step 3 ie. 'yourproject.test'
Step 5: Open you XF in view as published mode and you can see your custom clientlibs being loaded in the network calls
Hi @Madhur-Madan But clientlibs are not loading on the page.
Steps:
1. Create an experience fragment which will have those clientlibs.
2. Create a page and then include the above experience fragment.
3. Observe that clientlibs which are included in experience fragment are not loaded on the page
In that case you can simply overlay the experience fragment component and include the clientlibs in the html
Thanks
Please add the relevant client libs in the Page template as well using the Page policy. That should resolve the issue.
Hi @aanchal-sikka ,
Wouldnt' the clientlib be loaded on every page created using the same template even if the experience fragment component is not present on the page. That is why i overlayed the XF component so that the clientlib would only load when XF is present on the page.
If there are some other aspects you considered please let me know.
Thanks
What might be best for you, will depend on how your site, templates and XF usage is.
Hi @Madhur-Madan
I think you should include all your clientlibs(site CSS/JS) in the site clientlibs and load on Experience fragment editor as well rather than doing other way.
overlaying XF and loading clientlibs for XF can result in loading multiple clientlibs(more network call) even worse if more than one instance of XF is added on page.
@mvelicheti Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes