Skip to main content
Amr_Esam
September 3, 2022
Solved

External Javascript file for my plugin

I am trying to create a plugin with UI
the problem is ui.html file don’t want to load my ui.js tag

thanks for help

This topic has been closed for replies.
Gleb
GlebSolution
Power Member
January 10, 2024

this is the answer

15 replies

tank666
September 3, 2022

Embed your JavaScript code in HTML.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Amr_Esam
Amr_EsamAuthor
September 3, 2022

and what about accessing external libraries? same problem

tank666
September 3, 2022

How did you include the external library?
<script src="https://hostname.com/library.js"></script>? There shouldn’t be any problems with this.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Amr_Esam
Amr_EsamAuthor
September 3, 2022

like that
<script src="ui.js"></script>

tank666
September 3, 2022

You have to embed js code in HTML:

<script>
    //your code
</script>
UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Amr_Esam
Amr_EsamAuthor
September 3, 2022

So i cannot put my UI code in seprate js file?

Amr_Esam
Amr_EsamAuthor
September 3, 2022

It don’t even want to load js files like that:
<script src="https://hostname.com/library.js"></script>

tank666
September 3, 2022
figma.com

Sorry, but I can’t confirm this. For example, if I include the jQuery library, then I can access it in code.

<script src="https://code.jquery.com/jquery-3.6.1.min.js"></script>
<script>
    // Display the version number of the external library.
    console.log($.fn.jquery)
</script>
UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Amr_Esam
Amr_EsamAuthor
September 3, 2022

thank you 🙂

March 19, 2023

What is the difference between loading from CDN and local file? Why you can load via CDN but can’t the local js. What is the difference?