Javascript of a component not being applied | Community
Skip to main content
May 5, 2022
Solved

Javascript of a component not being applied

  • May 5, 2022
  • 3 replies
  • 1983 views

Hi, i'm struggling with this, i created a custom component called swcarousel and i'm trying to use a JS file with some functions that are used to change from image to image, the JS file is placed in the path

 

ui.frontend/src/main/webpack/components

 

but it still not working, someone has an idea how these JS files are used from there.

 

P.D Im need to do it from there and not from clientlibs for this component, and the SCSS file placed in the same path works

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by fedeperez

Thanks to everyone that tried to help, the problem is another one now.

3 replies

Kiran_Vedantam
Community Advisor
Community Advisor
May 5, 2022

Hi @fedeperez 

 

A couple of questions here:

Are the clientlibs getting generated for the component?

Did you add the client-libs in the HTL for the component?

 

Check this for reference: https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetype/uifrontend.html?lang=en

 

Thanks,

Kiran Vedantam.

Shubham_borole
Community Advisor
Community Advisor
May 5, 2022

Hi @fedeperez 

Do you have a set up where your js and css under "ui.frontend/src/main/webpack/components" are created under "/apps/project/clientlibs/uife(custom folder)/clientlib-carouselcomp"

This is configured at 'clientlib.config.js' I think. See https://github.com/adobe/aem-guides-wknd/blob/main/ui.frontend/clientlib.config.js 

 

Just wanted to make sure this is working well. And if you have the clientlib generated under /apps then that clientlib category should be included in template that includes the carousel component (or the component html it self) for the desired css or js to  load.

 

Hope this helps.

 

Shubham

fedeperezAuthorAccepted solution
May 5, 2022

Thanks to everyone that tried to help, the problem is another one now.