
figma-export
CLI从 Figma 文件批量导出组件(如整套图标)为 SVG,并把颜色、文字、阴影等样式导出为 Sass/SCSS 变量或 Style Dictionary 令牌,让网站上的图标与样式跟设计稿保持同步。需要 Node.js、Figma 个人访问令牌(FIGMA_TOKEN),并按需安装对应的输出插件(如 @figma-export/output-components-as-svg)。
Export tool for Figma.
You can easily and automatically export your figma components and styles and use them directly into your website.
:sparkles: In Short
Components
You can export your Figma Components as SVG and use them inside your website.
This is particularly useful when you have your own icon set and you want to keep your website icons up-to-date with your Figma file.
Styles
You can export your Figma Styles into different output like .sass format, .scss format, Style Dictionary tokens or you can create your own outputter.
If you want to keep the style of your Figma file in-sync with the
.cssof your website, this is a must-have.
:art: Colors (paints)
- Color
- Linear Gradient
:lollipop: Effects
Shadow and Blur effects cannot be combined together since they use two different CSS properties.
- Inner Shadow
- Drop Shadow
- Layer Blur
:pencil2: Text
- font-family
- font-weight
- font-size
- line-height
- letter-spacing
- font-style
- font-variant
- text-transform
- text-decoration
- text-align
:old_key: Personal Access Token
First of all you have to set the environment variable FIGMA_TOKEN.
To do so, you need a Personal Access Token. You can generate one from your Account Settings.
Inside the Account Settings click on Create a new personal access token and enter a description.
Copy the token, this is your only chance to do so!
export FIGMA_TOKEN=<personalAccessToken>
You can use dotenv or
exportthe variable using.bash_profile/.bashrcfile.
:test_tube: Just Try
Ensure you have Node.js installed in your system, the latest LTS is recommended. If you are not familiar with Node.js you can read their guide.
If you wanna try it just run following command and you will be able to download all components from https://www.figma.com/file/fzYhvQpqwhZDUImRz431Qo as .svg :sunglasses:
# export figma token
export FIGMA_TOKEN=<personalAccessToken>
# export figma components as svg
npx -p @figma-export/cli -p @figma-export/output-components-as-svg figma-export components fzYhvQpqwhZDUImRz431Qo -O @figma-export/output-components-as-svg
or you can export all styles into .scss
# export figma token
export FIGMA_TOKEN=<personalAccessToken>
# export figma styles as .scss variables
npx -p @figma-export/cli -p @figma-export/output-styles-as-sass figma-export styles fzYhvQpqwhZDUImRz431Qo -O @figma-export/output-styles-as-sass
:package: Packages
@figma-export/core
This package contains the core functionalities for figma-export. You can download and use it as a dependency of your project.
@figma-export/cli
This package allows you to consume all core functionalities from your terminal.
:book: Usage
Typically you'll prefer to use the cli. Here different ways to do the same:
Build Process
You can use figma-export as part of your build process.
npm install --save-dev @figma-export/cli @figma-export/output-components-as-svg @figma-export/output-styles-as-sass
# or using `yarn`
yarn add @figma-export/cli @figma-export/output-components-as-svg @figma-export/output-styles-as-sass --dev
Now you can create a script command inside your package.json.
Following an example:
{
"scripts": {
+ "figma:export-components": "figma-export components fzYhvQpqwhZDUImRz431Qo -O @figma-export/output-components-as-svg",
+ "figma:export-styles": "figma-export styles fzYhvQpqwhZDUImRz431Qo -O @figma-export/output-styles-as-sass",
}
}
Use it on the fly
Alternatively you can use npx to use it on the fly:
npx @figma-export/cli --help
Global Setup
You can also install it as a global dependency:
npm install -g @figma-export/cli
# or using `yarn`
yarn add @figma-export/cli --global
figma-export --help
Advanced
Last but not least, you can create a configuration file and use a single command to rule them all :ring:
Let's create the file .figmaexportrc.js and paste the following:
// @ts-check
import outputComponentsAsSvg from '@figma-export/output-components-as-svg'
import outputStylesAsSass from '@figma-export/output-styles-as-sass'
import transformSvgWithSvgo from '@figma-export/transform-svg-with-svgo'
/** @type { import('@figma-export/types').StylesCommandOptions } */
const styleOptions = {
fileId: 'fzYhvQpqwhZDUImRz431Qo',
// version: 'xxx123456', // optional - file's version history is only supported on paid Figma plans
// ids: ['138:52'], // optional - Export only specified node IDs (the `onlyFromPages` option is always ignored when set)
// onlyFromPages: ['icons'], // optional - Figma page names or IDs (all pages when not specified)
outputters: [
outputStylesAsSass({
output: './output'
})
]
}
/** @type { import('@figma-export/types').ComponentsCommandOptions } */
const componentOptions = {
fileId: 'fzYhvQpqwhZDUImRz431Qo',
// version: 'xxx123456', // optional - file's version history is only supported on paid Figma plans
// ids: ['54:22'], // optional - Export only specified node IDs (the `onlyFromPages` option is always ignored when set)
onlyFromPages: ['icons'],
transformers: [
transformSvgWithSvgo({
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false,
}
}
},
{
name: 'removeDimensions'
}
]
})
],
outputters: [
outputComponentsAsSvg({
output: './output'
})
]
}
/** @type { import('@figma-export/types').FigmaExportRC } */
export default {
commands: [
['styles', styleOptions],
['components', componentOptions]
]
}
:information_source: Take a look at .figmaexportrc.example.js for more details.
now you can install the @figma-export dependencies that you need
npm install --save-dev @figma-export/cli @figma-export/output-styles-as-sass @figma-export/transform-svg-with-svgo @figma-export/output-components-as-svg @figma-export/types
and update the package.json.
{
"scripts": {
+ "figma:export": "figma-export use-config"
}
}
If needed you can also provide a different configuration file.
{
"scripts": {
+ "figma:export": "figma-export use-config .figmaexportrc.production.js"
}
}
TypeScript
If you prefer, you can create a .figmaexportrc.ts and use TypeScript instead.
For doing so, you just need to install a few new dependencies in your project.
npm install --save-dev typescript tsx @types/node
and slightly change your package.json
{
"scripts": {
+ "figma:export": "tsx ./node_modules/@figma-export/cli/bin/run use-config .figmaexportrc.ts"
}
}
Take a look at .figmaexportrc.example.ts for more details.
Pure ESM package
This package is pure ESM. It cannot be require()'d from CommonJS.
If your package.json does not contain the "type": "module" field then you'll need to rename your .figmaexportrc.js configuration file:
- .figmaexportrc.js
+ .figmaexportrc.mjs
adjust the command you run:
figma-export use-config .figmaexportrc.mjs
and start using import foo from 'foo' instead of const foo = require('foo') to import the packages inside the .figmaexportrc.mjs. You can take a look at .figmaexportrc.example.js as an example.
:books: More Packages
For the list of all official packages or if you want to create your own transformer or outputter you can continue reading CLI Documentation.
相關資源

Sync Figma Token
Skill在代码里的设计令牌与 Figma 变量之间做同步:先把两边整理成统一格式,按值、别名、模式、作用域等类别列出差异并给出预演结果,必须等用户确认后才写入,默认只归档不删除,每次运行把报告存成 JSON。需要 Figma MCP,需手动调用。
firebenders/sync-figma-token-skill27
designlang
CLI用无头浏览器读取任意网站的设计系统,一条命令导出颜色、字体、间距等设计令牌(DTCG)、Tailwind 配置、Figma 变量和品牌规范手册,还能给配色对比度与多页一致性打分;也可作为 MCP 服务或 Claude Code 插件使用。需要 Node.js,首次要下载 Chromium(也可改用已安装的 Chrome)。
Manavarya09/design-extract4.3k
Figma Code Connect
CLIFigma 官方命令行工具:把 Figma 设计系统里的组件与代码仓库中的真实组件一一关联,发布后 Dev Mode 与 Figma MCP 给出的是生产代码片段而不是自动生成的示例;目前主推模板文件写法。需要 Node.js 18+、Figma Organization 或 Enterprise 套餐、完整的 Design 或 Dev Mode 席位及个人访问令牌。
figma/code-connect1.6k
figma-use
CLI在终端里用命令或 JSX 读写 Figma:创建框架与组件、插入 Iconify 图标、设置布局,可把节点导出为 JSX 或 Storybook,也能作为 MCP 服务器。需要 Figma 桌面版,126 及以上版本需用 daemon --pipe 模式连接。
dannote/figma-use611
Figma (Codex)
PluginFigma 出品、收录于 OpenAI 官方市场的 Codex 插件:按设计稿实现界面、生成 Code Connect 映射,还能在 Figma 里创建或更新页面、组件库、FigJam 图表和幻灯片。需要连接 Figma 账号。
openai/plugins7.5k
Talk to Figma MCP
MCP借助 Figma 插件与本地 WebSocket 服务,让 agent 读取并直接修改设计稿:建框架与文本、调整自动布局和样式、批量替换文案。需安装 Bun,现由 Grab 维护。
grab/cursor-talk-to-figma-mcp7.1k