Starter kit for creating Figma plugins
- 🏆 Full React support
- 🚀 Full Typescript support
- ✨ ESLint + Prettier setup
- ⚡️ Development mode with auto reload
- 🤖 Production mode with bundle optimization
- 🔥 Yarn v2 for dependencies management
- 💄 Emotion CSS in JS library for writing CSS
- 🎉 SVGR setup for svg management
Node.js v11.7.0+
- Download this respository content
- Create your own repository for plugin and change project info on your personal in
manifest.json
/package.json
(optional) - Install dependencies: run
yarn
in terminal - Sync plugin with Figma: in desktop app "Plugins" -> "Development" -> "New plugin" -> "Link existing plugin"
- For development:
yarn dev
and run plugin from Figma "Plugins" menu (Watch mode) - For production:
yarn prod
and run plugin from Figma "Plugins" menu (Optimized version)
ui.tsx – entrypoint for all interface code (iframe). Outputs in build/ui.html
code.ts – entrypoint for all figma logic code (sandbox). Outputs in build/code.js
components – folder with React components (.tsx)
utils – folder with scripts (.ts)
icons – folder with icons (.svg)
Project uses Yarn PnP feature so you need to show VSCode how to properly resolve your dependencies.
In your terminal run command:
yarn pnpify --sdk
And after that choose pnpify version of Typescript: open any TS file -> "Command + Shift + P" -> "Typescript: Select Typescript Version..." -> choose version with "pnpify" in name
Recommended editor settings:
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.suggest.showWords": false,
"editor.snippetSuggestions": "none",
"emmet.showAbbreviationSuggestions": false
And make sure you don't disable standart typescript and javascript validation!
yarn <command> |
Description |
---|---|
dev |
Develop your plugin in watch mode |
prod |
Build optimized version of your plugin |
eslint |
Lint all your scripts |
tsc |
Run typescript check |