Back to Plugins
Pencil.dev / .pen file import

Pencil.dev / .pen file import

Import .pen files seamlessly

Plugin Preview

Pencil.dev / .pen file import preview

About this plugin

# Pencil.dev Sync for Figma


> ⚠️ **Alpha Release** β€” This plugin was built through vibe coding by Martin Dubois from [QuatreCentQuatre](https://quatrecentquatre.com) to explore and test workflows between [Pencil](https://pencil.dev) and Figma. Depending on reception and usage, this project may be maintained long-term or evolve from prototype to production-ready status.


A Figma plugin to import and export `.pen` files from [pencil.dev](https://pencil.dev), enabling bidirectional sync between your Pencil designs and Figma projects.


## ✨ Features


- **πŸ“₯ Import** `.pen` files into Figma with full structure preservation

- **πŸ–ΌοΈ Local images** support via folder upload

- **🧩 Components** support with instances and overrides

- **🌍 Multilingual** UI (English / French, auto-detected)

- **πŸ“ Positioning** β€” Choose where to place imports on your canvas


upcoming:

- **πŸ“€ Export** Figma elements back to `.pen` format (for now use Pencil's paste from Figma feature)

- **πŸ”„ Bidirectional sync** via `pencilId` metadata stored in Figma nodes


## πŸš€ Installation


### Manual Installation (Development)


1. **Download or clone this repository**


2. **Import into Figma**:

- Open Figma Desktop

- Go to **Plugins** β†’ **Development** β†’ **Import plugin from manifest...**

- Select the `manifest.json` file from this folder


3. **Run the plugin**:

- **Plugins** β†’ **Development** β†’ **Pencil.dev Sync**


## πŸ“– Usage


### Importing a .pen file


1. Open the plugin

2. Stay on the **πŸ“₯ Import** tab

3. Drag & drop your `.pen` file or click to select

4. If your design has local images, click **Select images folder** and choose the folder containing your images

5. Click **Next β†’**

6. Navigate to where you want the import on your Figma canvas

7. Click **πŸ“ Place here**


### Exporting to .pen


1. Open the plugin

2. Switch to the **πŸ“€ Export** tab

3. Choose export mode:

- **Export selection** β€” Only selected elements

- **Export synced elements** β€” All elements previously imported from a `.pen` file

4. Click **πŸ“€ Export**

5. A `.pen` file will be downloaded


## 🎨 Supported Elements


| Pencil Type | Figma Conversion |

|-------------|------------------|

| `frame` | Frame (or Component if `reusable: true`) |

| `ref` | Component Instance |

| `text` | Text with styles |

| `rectangle` | Rectangle |

| `ellipse` / `circle` | Ellipse |

| `image` | Frame with image fill |

| `group` | Group |

| `line` | Line |

| `vector` / `path` | Vector |


### Supported Properties


- **Layout**: `vertical`, `horizontal`, `none` (auto-layout)

- **Dimensions**: Fixed, `fill_container`, `hug_contents`

- **Flexbox**: `justifyContent`, `alignItems`, `gap`

- **Padding**: Number, `[vertical, horizontal]`, or `[top, right, bottom, left]`

- **Color variables**: `$red`, `$white`, etc. (via `variables` object)

- **Fills**: Hex, rgb, rgba, and color tokens

- **Strokes**: `{ thickness: 1, fill: "$black" }`

- **Corner radius**: Number or array of 4 values

- **Text**: `content`, `fontFamily`, `fontSize`, `fontWeight`, `lineHeight`, `textAlign`

- **Components**: `reusable: true` creates Figma Components

- **Instances**: `type: "ref"` with `ref: "<componentId>"` and `descendants` overrides


## πŸ”„ Sync Mechanism


When importing, each element stores its Pencil ID as invisible metadata:


```javascript

figmaNode.setPluginData('pencilId', 'xvJuI');

figmaNode.setPluginData('pencilSync', 'true');

```


This enables:

- Finding elements by their original Pencil ID

- Re-exporting with preserved IDs for Pencil to match

- Tracking which elements are part of the sync


## πŸ“ .pen File Format


The plugin supports the native pencil.dev format:


```json

{

"version": "2.6",

"variables": {

"white": { "type": "color", "value": "#FFFFFF" },

"red": { "type": "color", "value": "#FF5046" }

},

"children": [

{

"type": "frame",

"id": "header1",

"name": "Header",

"reusable": true,

"width": "fill_container",

"height": 80,

"fill": "$white",

"layout": "horizontal",

"padding": [0, 80],

"justifyContent": "space_between",

"alignItems": "center",

"children": [...]

},

{

"type": "ref",

"id": "headerInstance1",

"ref": "header1",

"name": "Header Instance",

"descendants": {

"titleText": { "content": "New Title" }

}

}

]

}

```


## πŸ› Known Limitations


- **Images**: Local images require manual folder selection; URLs must be absolute

- **Fonts**: Falls back to Inter if a font is not available

- **Complex vectors**: May lose some path data in conversion

- **Nested components**: Deep nesting may have edge cases


## πŸ”§ Development


### Project Structure


```

figma-pencil-importer/

β”œβ”€β”€ manifest.json # Plugin configuration

β”œβ”€β”€ code.js # Main logic

β”œβ”€β”€ ui.html # User interface

β”œβ”€β”€ example.pen # Example file

└── README.md # This file

```


### Testing Changes


1. Edit the source files

2. In Figma, right-click the plugin β†’ **Run Last Plugin** or relaunch from the menu


## πŸ“ Changelog


### v0.1.1-alpha

- Improved handling of nested components


### v0.1.0-alpha

- Initial alpha release

- Import/Export functionality

- Component and instance support

- Local image upload

- Bidirectional sync via pluginData

- English/French localization

- Canvas positioning for imports


## πŸ‘¨β€πŸ’» Author


**Martin Dubois** β€” [QuatreCentQuatre](https://quatrecentquatre.com)


Built with Claude (Anthropic) through vibe coding sessions.


## πŸ“„ License


MIT License β€” See LICENSE file for details.


## πŸ”— Links


- [Pencil.dev](https://pencil.dev) β€” The design tool for IDEs

- [QuatreCentQuatre](https://quatrecentquatre.com) β€” Digital agency

- [Figma Plugin API](https://www.figma.com/plugin-docs/)

Plugin Details

Version3
CreatedJanuary 28, 2026
Last UpdatedJanuary 31, 2026
CategoryImport & export plugins
CreatorMartin Dubois
Stats72 installs, 13 likes
PricingFree

Technical Details

  • API:1.0.0
  • UI:ui.html
  • main:code.js
  • Document Access:dynamic-page
  • Editor Types:
    figma
  • Allowed Domains:
    • none