Home
Softono
figma-plugin-react-boilerplate

figma-plugin-react-boilerplate

Open source MIT TypeScript
19
Stars
7
Forks
0
Issues
1
Watchers
2 years
Last Commit

About figma-plugin-react-boilerplate

This repo offers a TypeScript-based React boilerplate for Figma plugins. It includes features such as SASS, CSS/SASS/SCSS modules, SVG image import, and up-to-date packages.

Platforms

Web Self-hosted

Languages

TypeScript

Links

🎨 React Boilerplate for Figma plugins βš›οΈ

preview

❓ What is this?

This is a boilerplate for creating a Figma plugin using React and Typescript.


Supports

  • SASS (SCSS)
  • CSS/SASS/SCSS Modules
  • Typescript
  • Import SVG images

πŸ“¦ Latest packages versions

  • @figma/plugin-typings: 1.68.0
  • react: 18.2.0

Structure

β”œβ”€β”€ src
β”‚   β”œβ”€β”€ app
β”‚   β”‚   β”œβ”€β”€ assets
β”‚   β”‚   β”œβ”€β”€ components
β”‚   β”‚   β”œβ”€β”€ styles
β”‚   β”œβ”€β”€ controller
β”‚   β”œβ”€β”€ App.tsx
β”‚   β”œβ”€β”€ index.tsx
β”‚   β”œβ”€β”€ index.html
β”œβ”€β”€ manifest.json
β”œβ”€β”€ .prettierrc.yml
β”œβ”€β”€ declaration.d.ts
β”œβ”€β”€ tsconfig.json
β”œβ”€β”€ webpack.config.js

src/app

This is where the main app is located. It is a React app that is rendered inside the Figma plugin.

src/controller

This is where the Figma controller is located. It is a Typescript file that is used to communicate with the Figma API.


πŸ› οΈ How to use

  1. Clone this repo
  2. Run yarn or npm install
  3. Run yarn dev or npm run dev
  4. Go to Figma and add a new plugin (Plugins -> Development -> Import plugin from manifest…)
  5. Run the plugin

βš™οΈ How to run

In the project directory, you can run:

  • yarn dev or npm run dev to run the app in the development mode.
  • yarn build or npm run build to build the app for production to the build folder.

❗ Important

  • run yarn build or npm run build before publishing the plugin to Figma. This will optimize the code and remove unnecessary files.
  • You'll need to restart plugin in Figma in order to see the changes during development.
  • Do not forget to replace the name and id of the plugin in the manifest.json file before publication.

πŸ“£ Feedback

If you have any feedback, please reach out to me here in issues, or on Twitter.