0
Fork 0
mirror of https://github.com/penpot/penpot-plugins.git synced 2025-01-08 07:50:44 -05:00
penpot-plugins/docs/create-plugin.md
2024-02-28 08:59:25 +01:00

724 B

npx nx g @nx/web:application example-plugin --directory=apps/example-plugin

Create a manifes.json in /public

{
  "name": "Example plugin",
  "code": "http://localhost:4201/plugin.js"
}

Add to the example vite.config.ts

build: {
  rollupOptions: {
    input: {
      plugin: 'src/plugin.ts',
      index: './index.html',
    },
    output: {
      entryFileNames: '[name].js',
    },
  },
}

Add to tsconfig.app.json

  "include": ["src/**/*.ts", "../../libs/plugins-runtime/src/lib/index.d.ts"]

Run static server npx nx run example-plugin:serve-static --port 4201

Go to penpot and load the plugin.

ɵloadPlugin({ manifest: 'http://localhost:4201/manifest.json' });