A comprehensive Figma plugin that converts your Figma designs directly into WordPress Gutenberg blocks with PHP and CSS code.
This project includes:
- Figma Plugin: Convert Figma designs to Gutenberg blocks
- WordPress Plugin Template: Ready-to-use WordPress plugin structure
- Documentation Site: 11ty + Tailwind CSS static site (optional)
npm installnpm run build:plugin-once- Open Figma Desktop App
- Go to Plugins β Development β Import plugin from manifest...
- Select
manifest.jsonfrom this directory - The plugin is now available in your Plugins menu
βββ manifest.json # Figma plugin manifest
βββ code.ts # Main plugin logic (TypeScript)
βββ code.js # Compiled plugin code (generated)
βββ ui.html # Plugin user interface
βββ tsconfig.json # TypeScript configuration
βββ FIGMA_PLUGIN_README.md # Detailed plugin documentation
βββ wordpress-plugin-template/ # WordPress plugin template
β βββ figma-blocks.php # Main plugin file
β βββ style.css # Frontend styles
β βββ editor.css # Editor styles
βββ src/ # Static site (optional)
- Use Frames for containers/sections
- Use Text layers for headings and paragraphs
- Use Auto Layout for flex containers
- Name layers descriptively (they become CSS classes)
- Select elements in Figma
- Open plugin: Plugins β Figma to Gutenberg Blocks
- Click "Convert to Blocks"
- Copy the generated code
- Copy the generated PHP code
- Paste into
wordpress-plugin-template/figma-blocks.php - Copy the CSS to
style.css - Upload to WordPress
wp-content/plugins/ - Activate the plugin
- Converts Frames, Groups, Components β Group blocks
- Converts Text layers β Heading or Paragraph blocks
- Extracts all styling (colors, typography, spacing)
- Preserves layout properties (Flexbox/Auto Layout)
- β Colors and opacity
- β Typography (font family, size, weight, line-height)
- β Borders and border radius
- β Shadows and effects
- β Padding and spacing
- β Flexbox layouts
- PHP Code: WordPress block registration
- JSON Structure: Block data structure
- CSS Styles: Extracted styles
# Build Figma plugin once
npm run build:plugin-once
# Build plugin in watch mode (auto-recompile)
npm run build:plugin
# Build static site (optional)
npm run build
# Run static site dev server (optional)
npm run dev- Make changes to
code.ts - Run
npm run build:plugin(watch mode) - Reload plugin in Figma: Plugins β Development β Reload
For detailed documentation, see:
- FIGMA_PLUGIN_README.md - Complete plugin guide
- wordpress-plugin-template/README.md - WordPress integration
- Frames and Auto Layout
- Text layers with styling
- Groups and Components
- Solid fills and strokes
- Drop shadows
- Border radius
- Opacity
- Padding and spacing
- Gradients (first color used)
- Multiple fills (first fill used)
- Effects (drop shadows only)
- Images (coming soon)
- Blend modes
- Advanced vector shapes
- Masks
- Boolean operations
- Use Figma Desktop (not browser)
- Run
npm run build:plugin-once - Verify
code.jsexists
- Ensure elements are selected
- Check console for errors
- Some complex nodes may not be supported
- Use solid fills (not gradients)
- Check supported features list
- Complex styles may need manual adjustment
- Use descriptive layer names
- Names become CSS classes
- Use kebab-case for best results
- Use Auto Layout for containers
- Set proper alignment and spacing
- Use padding on frames
- Font sizes determine heading levels:
- 32px+ β H1
- 24px+ β H2
- 20px+ β H3
- Below 20px β Paragraph
Contributions are welcome! Feel free to:
- Report bugs
- Suggest features
- Submit pull requests
MIT License - free to use in your projects!
Built with:
- TypeScript
- Figma Plugin API
- WordPress Gutenberg Block API
- 11ty + Tailwind CSS (for documentation site)