Hello, Im new to alfresco5 and i m building some surf pages where i need to use some external libraries on them (i.e. dragula , datatables,etc)
To load those libraries (not even try to use them) i use this directive in the html.ftl :
<@markup id="js">
<@script type="text/javascript" src="${page.url.context}/res/components/js/dragula.js"></@script>
</@>
Well, it seems its not the proper way to load them since i get multipledefine errors browser
I know the problem has to do with dojo, but i dont know exactly how make dojo load external libraries.
It s extrange since some custom javascripsi have made are loaded ok.
Does any one know how to proper load external javascripts avoiding dojo colisions?
Are you trying to build a page using Aikau or YUI? If the former, you should try to load external libraries using the Dojo loader instead of using <@script> inclusions, which are only meant for the latter / legacy case. From looking at dragula, I can't see what should be causing this error - I don't see anything that would be defined multiple times just by including that library. I suspect the error may be caused by some other issue, i.e. are you trying to create a page with multiple Dojo-based components? In Aikau, the expectation is that only one component is using Dojo / Aikau, i.e. in legacy pages it is the share-header, in Aikau-pages it is the sole component bound to the page.
Thanks for your answer, i tried loading it with dojo and it worked in almost all libraries.There is ,still , a library that doesnt work yet (dragula).
I used this code to load it :
require(["https://cdnjs.cloudflare.com/ajax/libs/dragula/3.7.2/dragula.js"], function(){
dragula([document.getElementById('left-defaults')]);
});
the library gets loaded correctly , but it doesnt work properly.But i think that this a problem out of the scope of this question.
many thanks.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.