Hello,
I am developing custom controls for alfresco share (by creating Freemarker templates) and I would like to include additional JavaScript libraries (i.e. Select2). How can I achieve that?
Normally i would put them in <head> tag, but in .ftl files it does not work.
Regards,
Mike
You need to add those files as dependency in share-config-custom.xml.
<config>
<forms>
<dependencies>
<css src="/res/scripts/DITAStorm/styles.css" />
<js src="/res/scripts/DITAStorm/DITAStorm.js" />
</dependencies>
</forms>
</config>
Thank you, but I am on Docker so do not have direct access to /res/scripts folder.
I also cannot provide absolute path because it is adding "http://localhost:8180/share/res/com/myproject/" all the time.
Of course I tried to add those files into the src/main/resources/alfresco/web-extension/site-webscripts/com/myproject or src/main/resources/res/scripts/ folder but it does not work :/
You need to place js file inside src/main/amp/web/js of share folder.
Thank you for the answer. I managed to do it by modifying Dockerfile but your solution seems to be better.
Unfortunately, the script throws an error in the browser.
It looks like the library itself have an error somewhere (which is obviously a nonsense - it is working on my demo HTML page). Maybe it is connected with the fact that Alfresco has it's own, very limited, Javascript engine (Rhino)... or because this library needs jQuery which might be loading after this script
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.