Skip to main content
Solved

How to add image asset when creating a plugin

  • September 28, 2022
  • 7 replies
  • 2525 views

Olushola

I am creating a figma plugin and I cannot add an svg image to the ui.html, please help

Best answer by tank666

figma.com
View original
This topic has been closed for comments

tank666
  • September 28, 2022

How do you add SVG to HTML?


Olushola
  <img src="search.svg" alt="" width="120">

Please note that the SVG and ui.html are in the same directory


tank666
  • September 29, 2022

Olushola

This worked, thanks for the help


Olushola

I have another problem though,

I used figma.ui.postMessage('msg') in my code.ts file to send a message to the ui, then I listen to the message in ui.html using onmessage = (event) => { console.log("got this from the plugin code", event.data.pluginMessage) } but I do not get any response in my ui.html


tank666
  • October 1, 2022

I’m not sure why this happened, because the code is correct.
So you don’t see the line got this from the plugin code msg in the console?


Olushola

After I debugged for a while, I found out onmessage = (event) => { console.log("got this from the plugin code", event.data.pluginMessage) } should come immediately after opening the ui.html <script> tag.
I think my issues have been resolved successfully.

Thanks for you help


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings