Skip to main content
Solved

Download option while using figma code generation


When using Figma plugin for code generation in dev mode, the output is usually displayed in one of the subsections Inspect panel.
This output of code generation is available with one option - “Copy”
Is there a way to download the codegen output ?

Best answer by nirvana7

Thanks for the response. However this is not an exiting code generation plugin that i am trying to download.
I am creating a new plugin and want an option to download the generated output.
Can you please guide me for the same.

View original
This topic has been closed for comments

10 replies

tank666
  • 4868 replies
  • February 2, 2024

Some codegen plugins provide the ability to export code snippets. Just click on the “Inspect settings” icon next to the plugin name and select the item you need.


  • Author
  • 5 replies
  • February 2, 2024

I am unsure where this setting is.
This is what i see in my inspect panel for a codegen plugin


tank666
  • 4868 replies
  • February 2, 2024


“Inspect settings” icon.


  • Author
  • 5 replies
  • Answer
  • February 5, 2024

Thanks for the response. However this is not an exiting code generation plugin that i am trying to download.
I am creating a new plugin and want an option to download the generated output.
Can you please guide me for the same.


tank666
  • 4868 replies
  • February 5, 2024

In this case, you need to study the following docs:

figma.com

https://www.figma.com/plugin-docs/api/CodegenPreferencesEvent/

In short: add codegenPreferences to the manifest, listen to the preferenceschange event, pass the code to the UI and call the download function.


  • Author
  • 5 replies
  • February 6, 2024

Thank you, i have already checked some of the docs and will explore others too.
Also you mentioned call the download function, are you referring to some native method for this ? Any example that i can leverage ?


tank666
  • 4868 replies
  • February 6, 2024
stackoverflow.com

You can also Google it yourself.


  • Author
  • 5 replies
  • February 6, 2024

Ah nice, a javascript function is even better. Initially i thought if there is any native support from Figma for downloads. Thanks @tank666


Burbach_Brandon

Hi @nirvana7 and @tank666, I am working on a similar problem where I am trying to access the native HTML code generated by in the Figma Inspect panel shown below via the API →

Is there a way for my plugin to access this natively generated code via the API?


tank666
  • 4868 replies
  • March 7, 2024

In this screenshot I can see that the HTML code was generated by a third party plugin. In this case, I suggest you contact its creator.


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