Can i add external script to template node?

Hi everyone! as the title suggest, i'm trying (well, i haven't tryed yet, because i don't know how) to add an external script to the template node, should i put the .js in a special folder of the server?

i'll leave you the code that i'm using. All the data is coming from a SQLite database from a previous node (i won't append that node because i would have to give you the db)

https://pastebin.com/10yQ5piN

Thanks for reading, very grateful!

Regular template or ui_template?

If it is a ui_template, you could try having a file-in node read the script, stick it in msg.template and pass that to the ui_template and set the ui_template 'Template type' to 'Added to site section.

it's ui_template, i'll try that!

should it work if i just copy all the "text" of the .js file and paste it on my script?

Depends on what the script does :grin:
Did you try

Yes, i tried. I copied all the text from that .js and pasted it on one ui_dashboard and selected the "add to the head section" option, and it worked just fine. Althought there were some functions that i can't make them to work, i'll investigate a little more.

Thanks!

1 Like