It's all about the answers!

Ask a question

Call to external libraries within Publishing


Alioune COULIBALY (11) | asked Mar 14 '23, 9:08 a.m.

Hello there,

I am desperatly trying to use javascript external (i.e. not functions in a javascript code palette element) libraries (for instance jquery.js or underscore.js) in a Publishing template.
But I can't manage to get through!

My wish is to be able:
1°) Ideally to put a reference(same principle as in html pages, e.g. <script src="jquery-3.6.3.js"></script>) somewhere in Publishing document studio.
2°) if reference are not possible, what code structure to use for copying and pasting ? I tried to paste the code of the jquery-3.6.3.js file and it yielded errors.

Thanks in advance for your help.
Regards
Alioun


Comments
Fariz Saracevic commented Mar 15 '23, 7:48 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

Hi Alioune,


As far as I know, you would not be able to add javascript external call directly from a template. You would need to use PUB javascripting capability to extent it but I am not sure if this is possible. Searching https://stackoverflow.com/, I see quite a bit of responses where using external libraries with javascript. Also, PUB javascripting is valuable for PUB customers but it is provided as-is, so this community is good place to seek answer. Thanks for raising this question.

It would help if you could provide your details of your use case as there might be other ways to solve your problem.


Alioune COULIBALY commented Mar 16 '23, 4:46 a.m. | edited Mar 16 '23, 4:49 a.m.
Hi there Fariz,
Thanks for this clear answer.
FYI I have no particular use case to supply you with. This was a general question asked by several customers and I wanted to have a clear status on the topic.
As for me, using code from libraries via javascript code import in a javascript code element of a PUB template is fine enough.
Kind regards
Alioune

Be the first one to answer this question!


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.