Overlaying clientlibs in AEM 6.2 is successfully overlaying BUT ALSO implementing seperately, essentially calling the script twice
Hello, I'm having trouble predicting the behavior of overriding a (Javascript) client library. This is what's happening:
etc/clientlibs/foo.js console.log("Hello from etc"); libs/clientlibs/foo.js console.log("Hello from libs");Expected statement printed to the console:
Hello from etc
Actual printed statement:
Hello from etc Hello from etc
When I investigate, both statements are printed from foo.js BUT the first is from etc and the second is from libs. Sometimes clearing the cache results in
Hello from etc Hello from libs
but that is also not the desired output. And sometimes the printed statement will be
Hello from libs
failing to override libs/clientlibs/foo.js or even calling etc/clientlibs/foo.js
to be more concrete, I'm trying to override
/libs/granite/ui/components/coral/foundation/clientlibs/foundation
I've tried modifying the categories from
granite.ui.coral.foundation
to
mysite.granite.ui.coral.foundation
but I don't know what that does, and it seems to prevent the overlaying. I don't have a good understanding of how (specifically by what function) the foo.js script is built either. (I do understand that the js.txt, which lists the JS files to combine, are inside the clientlibs/foo directory which makes the combined foo.js, but I don't know where in AEM this being constructed.)
My question is, how do I make this work? :)