figma-to-html-cli
v0.4.2
Published
Convert Figma designs to pixel-perfect HTML/CSS via API
Downloads
1,258
Maintainers
Readme
figma-to-html-cli
Convert Figma designs to pixel-perfect HTML/CSS via the Figma REST API.
Requirements
- Node.js 18+
- Figma API token (Settings > Security > Personal Access Tokens)
Quick Start
npx figma-to-html-cli "https://www.figma.com/design/ABC123/MyProject?node-id=33-3" --token=figd_xxxUsage
# Using environment variable for token
export FIGMA_API_TOKEN=figd_xxx
npx figma-to-html-cli "https://www.figma.com/design/ABC123/MyProject?node-id=33-3"
# Custom output directory
npx figma-to-html-cli "https://www.figma.com/design/ABC123/MyProject?node-id=33-3" --token=figd_xxx --output=./my-landing
# Using /file/ URL format
npx figma-to-html-cli "https://www.figma.com/file/ABC123/MyProject?node-id=33-3" --token=figd_xxxWhat it does
- Parses the Figma URL to extract the file key and node ID
- Fetches the node tree and image fills from the Figma API
- Preprocesses the data into sections, design tokens, and an assets manifest
- Downloads image fills and exports SVG icons
- Generates HTML with absolute positioning (pixel-perfect)
- Converts absolute layout to relative/flex where Figma auto-layout is used
Output structure
output/
index.html
css/
variables.css
sections/
s01-header.css
s02-hero.css
...
js/
main.js
assets/
images/
icons/
preprocessed/
overview.json
design-tokens.json
assets-manifest.json
sections/License
MIT
