yuanqing / create-figma-plugin

:battery: The comprehensive toolkit for developing plugins and widgets for Figma and FigJam
https://yuanqing.github.io/create-figma-plugin/
MIT License
948 stars 91 forks source link

esbuild plug-ins postcss / tailwindcss not working #229

Closed emkayy closed 4 weeks ago

emkayy commented 6 months ago

I tried adding tailwind through an esbuild plug-in in various different ways. However, it seems like the plug-ins are never initiated. This is my build-figma-plugin.main.js:

const { tailwindPlugin } = require("esbuild-plugin-tailwindcss");
const postcss = require("esbuild-postcss");

module.exports = function (buildOptions) {
  const config = {
    ...buildOptions,
    plugins: [...buildOptions.plugins, postcss() /* tailwindPlugin() */],
  };
  return config;
};

I also tried passing the plugin config directly:

plugins: [
    postcss({
      plugins: [
        tailwindcss('./tailwind.config.js'), // also tried without config path and passing config object
      ],
    }),
  ],

Here is a minimal setup tailwindpostcss.zip

Is there a special way you have to add / configure esbuild plug-ins?

yuanqing commented 3 months ago

Suggest using the plugin/preact-tailwindcss template