vibefigma
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVibeFigma - Figma to React Converter
VibeFigma - Figma转React转换器
Convert Figma designs into React components with Tailwind CSS using the CLI.
vibefigma使用 CLI将Figma设计转换为搭配Tailwind CSS的React组件。
vibefigmaUsage
使用方法
Interactive Mode (Recommended for first-time users)
交互式模式(推荐首次用户使用)
bash
npx vibefigma --interactivePrompts for Figma URL, access token, and output paths.
bash
npx vibefigma --interactive会提示输入Figma URL、访问令牌和输出路径。
Direct Command
直接命令
bash
npx vibefigma "https://www.figma.com/design/FILE_ID?node-id=X-Y" --token FIGMA_TOKENbash
npx vibefigma "https://www.figma.com/design/FILE_ID?node-id=X-Y" --token FIGMA_TOKENWith Environment Variable
使用环境变量
bash
export FIGMA_TOKEN=your_token
npx vibefigma "https://www.figma.com/design/FILE_ID?node-id=X-Y"bash
export FIGMA_TOKEN=your_token
npx vibefigma "https://www.figma.com/design/FILE_ID?node-id=X-Y"Using .env File
使用.env文件
The user can add their Figma access token to a file in their project root:
.envenv
FIGMA_TOKEN=your_token_hereThen run:
bash
npx vibefigma "https://www.figma.com/design/FILE_ID?node-id=X-Y"Note: If the token is not configured, vibefigma will throw an error. Only then inform the user about the token requirement.
用户可在项目根目录的文件中添加Figma访问令牌:
.envenv
FIGMA_TOKEN=your_token_here然后运行:
bash
npx vibefigma "https://www.figma.com/design/FILE_ID?node-id=X-Y"注意:如果未配置令牌,vibefigma会抛出错误,此时需告知用户令牌的要求。
Common Options
常用选项
| Option | Description |
|---|---|
| Figma access token |
| Output path (default: |
| Assets directory (default: |
| Overwrite existing files without confirmation |
| Generate regular CSS instead |
| 选项 | 描述 |
|---|---|
| Figma访问令牌 |
| 输出路径(默认: |
| 资源目录(默认: |
| 无需确认即可覆盖现有文件 |
| 生成常规CSS代码替代Tailwind CSS |
Getting a Figma Access Token
获取Figma访问令牌
- Go to Figma Account Settings
- Scroll to Personal Access Tokens
- Click Generate new token → name it → copy immediately
- Store it securely in a file or pass via
.envflag--token
- 前往Figma账户设置
- 滚动到个人访问令牌部分
- 点击生成新令牌 → 命名后立即复制
- 将令牌安全存储在文件中,或通过
.env参数传递--token
Workflow
工作流程
- Get Figma URL with specific node selected (frame/component to convert)
- Check if output file already exists at the target path (default: or user-specified path)
./src/components/[Name].tsx - If file exists, ask the user for confirmation before overwriting, then use the flag
--force - Run: (add
npx vibefigma "<URL>" -c <output-path>if overwriting confirmed)--force- User configures token in .env or via --token flag
- If vibefigma throws a token error, inform the user about the token requirement
- Review generated component
- If code needs cleanup, see for making code responsive and production-ready
references/responsive-cleanup.md
- 获取选中特定节点/框架的Figma URL(要转换的目标)
- 检查目标路径下是否已存在输出文件(默认路径:或用户指定路径)
./src/components/[Name].tsx - 如果文件已存在,先询问用户是否确认覆盖,之后可使用参数
--force - 运行:(如果确认覆盖,添加
npx vibefigma "<URL>" -c <输出路径>参数)--force- 用户通过.env文件或--token参数配置令牌
- 如果vibefigma抛出令牌错误,告知用户令牌的要求
- 检查生成的组件
- 如果代码需要清理,可查看以优化代码的响应式和生产就绪性
references/responsive-cleanup.md
Output
输出内容
VibeFigma generates:
- React component () with Tailwind CSS classes
.tsx - Assets (images/icons) in the assets directory
VibeFigma会生成:
- 带有Tailwind CSS类的React组件(文件)
.tsx - 资源文件(图片/图标)存储在资源目录中
Notes
注意事项
- Always select a specific node/frame in Figma URL for best results
- Generated code may need manual cleanup for production use
- See for responsive design patterns
references/responsive-cleanup.md
- 为获得最佳效果,请确保Figma URL中选中了特定的节点/框架
- 生成的代码可能需要手动清理才能用于生产环境
- 可查看了解响应式设计模式
references/responsive-cleanup.md