Linking CSS to UI.HTML

How do I import CSS to my UI.HTML file? I’ve been trying forever but unfortunately with no luck.

ui.css is linked in my project folder, not under any folders.

Here’s what I currently have in my ui.html file:

<link rel="stylesheet" href="ui.css">

Any help is appreciated. Thank you so much!! <3

When I try the same code in the browser, it links and the elements change but, when I open my Figma Plugin’s UI window, there’s no luck.

The plugin only loads what’s listed in the manifest.json, ignoring all other files. Since it only allows you to specify HTML for UI and JS for backend, you have three options here:

  1. Write CSS and JS inside of the HTML file so you don’t have to load them from other files.

  2. Host and load CSS and JS from the web. Not every hosting would work due to CORS and the plugin having origin set to null. This isn’t a very common way I think.

  3. Use a bundler to inline all files you want into HTML. This is good for larger plugins where writing CSS and JS directly inside of the HTML file would be difficult. You can use Rollup, Webpack, esbuild and anything else you like.

1 Like

Worked like a charm! Thanks so much. Have an excellent weekend!