-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathllms-full.txt
More file actions
2976 lines (2194 loc) · 72.4 KB
/
Copy pathllms-full.txt
File metadata and controls
2976 lines (2194 loc) · 72.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# ExFig
> Command-line utility to export colors, typography, icons, and images from Figma
> to Xcode, Android Studio, Flutter, and Web (React/TypeScript) projects.
> Supports Dark Mode, SwiftUI, UIKit, Jetpack Compose, Flutter, and React/TypeScript.
> Configuration via PKL. Jinja2 templates for custom code generation.
## Documentation
### README
# ExFig
Export colors, typography, icons, and images from Figma and Penpot to Xcode, Android Studio, Flutter, and Web projects — automatically. Runs on macOS, Linux, and Windows.
## The Problem
- Figma has no "Export to Xcode" button. You copy hex codes by hand, one by one.
- Switching from Figma to Penpot? Your export pipeline shouldn't break.
- Every color change means updating files across 3 platforms manually.
- Dark mode variant? An afternoon spent on light/dark pairs and @1x/@2x/@3x PNGs.
- Android gets XML. iOS gets xcassets. Flutter gets Dart. Someone maintains all three.
- Design and code drift apart because nobody runs the manual export often enough.
## Who Is This For?
**iOS developer** — You have 100+ colors and 200+ icons. ExFig generates Color Sets with light/dark/high-contrast variants, PDF vectors in `.xcassets`, and type-safe SwiftUI + UIKit extensions.
**Android developer** — Your team uses Compose but legacy views need XML. ExFig generates both: `colors.xml` for views, Compose `Color` objects, and `VectorDrawable` icons with pathData validation.
**Flutter developer** — You need dark mode icon variants and `@2x`/`@3x` image scales. ExFig exports SVG icons with dark suffixes, raster images with scale directories, and Dart constants.
**Design Systems lead** — One Figma or Penpot file feeds four platforms. ExFig's unified PKL config exports everything from a single `exfig batch` run. One CI pipeline, one source of truth.
**CI/CD engineer** — Quiet mode, JSON reports, exit codes, version tracking, and checkpoint/resume. The [GitHub Action](https://github.com/DesignPipe/exfig-action) handles installation and caching.
## Quick Start
```bash
# 1. Install
brew install designpipe/tap/exfig
# 2. Set Figma token (or PENPOT_ACCESS_TOKEN for Penpot)
export FIGMA_PERSONAL_TOKEN=your_token_here
# 3a. Quick one-off export (interactive wizard)
exfig fetch
# 3b. Or generate config for full pipeline (interactive wizard)
exfig init
exfig batch exfig.pkl
```
See the [Getting Started guide](https://DesignPipe.github.io/exfig/documentation/exfigcli/gettingstarted) for detailed setup, including Mint, mise, and building from source.
## GitHub Action
```yaml
- uses: DesignPipe/exfig-action@v1
with:
figma_token: ${{ secrets.FIGMA_TOKEN }}
command: batch exfig.pkl
cache: true
```
## Claude Code Plugins
Use ExFig directly from Claude Code with the [exfig-plugins](https://github.com/DesignPipe/exfig-plugins) marketplace:
```bash
claude /plugin marketplace add https://github.com/DesignPipe/exfig-plugins
```
Includes MCP integration, setup wizard, config review, troubleshooting, and `/export-*` slash commands.
## Documentation
Full documentation — platform guides, configuration reference, batch processing, design tokens, custom templates, and MCP server — is available at **[DesignPipe.github.io/exfig](https://DesignPipe.github.io/exfig/documentation/exfigcli)**.
Configuration reference: [CONFIG.md](CONFIG.md).
## Contributing
See the [Development Guide](https://DesignPipe.github.io/exfig/documentation/exfigcli/development) for setup, testing, and code style.
## License
MIT. See [LICENSE](LICENSE).
---
<sub>Originally inspired by [figma-export](https://github.com/RedMadRobot/figma-export).</sub>
### Getting Started
# Getting Started
Install ExFig and configure your first export.
## Overview
ExFig is a command-line tool that exports design resources from Figma and Penpot to iOS, Android, Flutter, and Web projects.
## Requirements
- macOS 13.0 or later, Linux (Ubuntu 22.04), or Windows (Swift 6.3+)
- Figma account with file access, **or** Penpot account
- Figma Personal Access Token (for Figma sources) or Penpot Access Token (for Penpot sources)
## Installation
### Using Homebrew (Recommended)
```bash
brew install designpipe/tap/exfig
```
### Using Mint
```bash
mint install DesignPipe/exfig
```
### Using Mise
```bash
mise use -g github:DesignPipe/exfig
```
### From Source
```bash
git clone https://github.com/DesignPipe/exfig.git
cd ExFig
swift build -c release
cp .build/release/exfig /usr/local/bin/
```
### Download Binary
Download the latest release from [GitHub Releases](https://github.com/DesignPipe/exfig/releases).
## Authentication
### Figma Access Token
ExFig requires a Figma Personal Access Token to access the Figma API.
### Create a Token
1. Open [Figma Account Settings](https://www.figma.com/settings)
2. Scroll to **Personal access tokens**
3. Click **Create a new personal access token**
4. Give it a descriptive name (e.g., "ExFig CLI")
5. Copy the generated token
### Set the Token
Set the `FIGMA_PERSONAL_TOKEN` environment variable:
```bash nocopy
# Add to ~/.zshrc or ~/.bashrc
export FIGMA_PERSONAL_TOKEN="your-token-here"
```
Or pass it directly to commands:
```bash nocopy
FIGMA_PERSONAL_TOKEN="your-token" exfig colors
```
### Penpot Access Token
For Penpot sources, set the `PENPOT_ACCESS_TOKEN` environment variable:
1. Open your Penpot instance → Settings → Access Tokens
2. Create a new token
3. Set it:
```bash nocopy
export PENPOT_ACCESS_TOKEN="your-penpot-token-here"
```
> Note: `PENPOT_ACCESS_TOKEN` is only required when using `penpotSource` in config.
### Quick Penpot Icons Export (No Config)
```bash
# Export Penpot icons as SVG
export PENPOT_ACCESS_TOKEN="your-token"
exfig fetch --source penpot -f "file-uuid" -r "Icons" -o ./icons --format svg
# Export as PNG at 3x scale
exfig fetch --source penpot -f "file-uuid" -r "Icons" -o ./icons --format png --scale 3
```
> File UUID is in the Penpot workspace URL: `?file-id=UUID`.
> For shared libraries, use the library's file ID from the Assets panel.
## Quick Start
### 1. Initialize Configuration
Generate a starter configuration file for your platform:
```bash
# For iOS projects
exfig init --platform ios
# For Android projects
exfig init --platform android
# For Flutter projects
exfig init --platform flutter
```
This creates an `exfig.pkl` file in your current directory.
### 2. Get Your Figma File ID
The file ID is in the Figma URL:
```
https://www.figma.com/file/ABC123xyz/My-Design-System
^^^^^^^^^^^
This is your file ID
```
### 3. Configure exfig.pkl
Edit the generated `exfig.pkl`:
```pkl
amends ".exfig/schemas/ExFig.pkl"
import ".exfig/schemas/Figma.pkl"
import ".exfig/schemas/iOS.pkl"
figma = new Figma.FigmaConfig {
lightFileId = "YOUR_FILE_ID_HERE"
}
ios = new iOS.iOSConfig {
xcodeprojPath = "./MyApp.xcodeproj"
xcassetsPath = "./Resources/Assets.xcassets"
// ... other iOS settings
}
```
### 4. Validate & Export
```bash
# Validate Figma file structure before exporting
exfig lint
# Export individual resource types
exfig colors
exfig icons
exfig images
exfig typography
# Or export everything at once with batch
exfig batch exfig.pkl
```
> Note: Individual commands use the `-i` flag for custom config paths (`exfig colors -i path.pkl`),
> while `batch` takes paths as positional arguments (`exfig batch path.pkl`).
## What's Next
- Usage - Learn about all CLI commands and options
- Configuration - Full configuration reference
- DesignRequirements - How to structure your Figma files
- iOS - iOS-specific export guide
- Android - Android-specific export guide
- Flutter - Flutter-specific export guide
### Usage
# Usage
Command-line interface reference and common usage patterns.
## Overview
ExFig provides commands for exporting colors, icons, images, and typography from Figma and Penpot to native platform resources.
## Basic Commands
```bash
# Export colors
exfig colors
# Export icons
exfig icons
# Export images
exfig images
# Export typography
exfig typography
```
## Getting Started
Generate a config file with the interactive wizard:
```bash
exfig init
```
The wizard guides you through platform selection, asset types, and Figma file IDs.
For non-interactive use, specify the platform directly:
```bash
exfig init -p ios # Full iOS template
exfig init -p android # Full Android template
```
## Configuration File
By default, ExFig looks for `exfig.pkl` in the current directory. Specify a different location:
```bash
exfig colors -i path/to/exfig.pkl
exfig colors --input path/to/exfig.pkl
```
## Filtering Exports
Export specific items by name:
### Single Item
```bash
exfig icons "ic/24/edit"
```
### Multiple Items
Separate names with commas:
```bash
exfig icons "ic/24/edit, ic/16/notification"
```
### Wildcard Patterns
Use `*` to match multiple items:
```bash
# Export all icons starting with "ic/24/videoplayer/"
exfig icons "ic/24/videoplayer/*"
# Export all colors starting with "common/"
exfig colors "common/*"
# Export all typography styles starting with "heading/"
exfig typography "heading/*"
```
> Note: Wildcard patterns don't work on Linux systems.
## Version Tracking
Skip unchanged exports with version tracking:
```bash
# Enable version tracking
exfig colors --cache
exfig icons --cache
# Disable version tracking
exfig icons --no-cache
# Force export and update cache
exfig icons --force
# Custom cache file path
exfig icons --cache-path ./custom-cache.json
```
> Note: The version changes when a Figma library is **published**, not on every auto-save.
For batch mode version tracking and granular cache, see BatchProcessing.
## Fault Tolerance
All commands support fault tolerance options:
### Basic Options
```bash
# Custom retry count (default: 4)
exfig colors --max-retries 6
# Custom rate limit (default: 10 req/min)
exfig icons --rate-limit 20
```
### Extended Options
Commands that download many files (`icons`, `images`, `fetch`, `download all`) support additional options:
```bash
# Stop on first error
exfig icons --fail-fast
# Resume from checkpoint after interruption
exfig images --resume
# Increase concurrent downloads (default: 20)
exfig icons --concurrent-downloads 50
```
| Option | Description | Commands | PKL key |
| ------------------------ | ---------------------------------------------- | --------------------- | ----------------------------- |
| `--max-retries` | Maximum retry attempts (default: 4) | All | `figma.maxRetries` |
| `--rate-limit` | API requests per minute (default: 10) | All | `figma.rateLimit` |
| `--timeout` | Figma API request timeout, sec (default: 30) | All | `figma.timeout` |
| `--concurrent-downloads` | Concurrent CDN downloads (default: 20) | icons, images, fetch, download all, batch | `figma.concurrentDownloads`* |
| `--fail-fast` | Stop immediately on error | icons, images, batch, fetch | `batch.failFast` (batch only)†|
| `--resume` | Continue from checkpoint | icons, images, batch, fetch | `batch.resume` (batch only)† |
| `--parallel` | Concurrent batch configs (default: 3) | batch | `batch.parallel` |
CLI flags override PKL config; PKL config overrides built-in defaults. `fetch` is config-free —
only CLI flags and built-in defaults apply there.
*`figma.concurrentDownloads` is silently ignored by `colors`/`typography` (no CDN downloads); under
`-v` a debug log records the skip.
†The `batch.failFast` / `batch.resume` PKL keys apply ONLY to `exfig batch`. Standalone `icons` /
`images` commands accept the corresponding CLI flags but do not read these PKL fields.
### Checkpoint System
Long-running exports create checkpoints for resumption:
```bash
# Resume interrupted export
exfig icons --resume
# Checkpoints stored in: .exfig-checkpoint.json
# Checkpoints expire after 24 hours
# Successful completion deletes the checkpoint
```
## Quick Fetch
Download images without a configuration file. Run `exfig fetch` with no arguments for an
interactive wizard that guides you through file ID, asset type, platform, frame selection,
format, output directory, and more:
```bash
# Interactive wizard — asks platform, format, output step by step
exfig fetch
# Or pass all options directly
exfig fetch --file-id YOUR_FILE_ID --frame "Illustrations" --output ./images
# Using short options
exfig fetch -f YOUR_FILE_ID -r "Icons" -o ./icons
```
The wizard provides smart defaults per platform (e.g., SVG + camelCase for iOS icons,
WebP + snake_case for Android illustrations) and only runs in interactive terminals.
### Disambiguating Frames by Page
When the same frame name appears on multiple Figma pages (e.g., a `🏞 Illustrations` file
with frame `InDrive` on both an "Old" and a "New" page), use `-p` / `--page` to filter
by page name and avoid downloading components from the wrong frame:
```bash
# Only components from frame "InDrive" on the specified page
exfig fetch \
-f wdUfYHrScBXtgRSyCbwY31 \
-r "InDrive" \
-p "New illustration - figma export" \
-o ./illustrations \
--format svg
```
Without `--page`, `fetch` matches the frame name across the entire file, which can pull in
components from frames you didn't intend to export.
### Format Options
```bash
# SVG (vector)
exfig fetch -f abc123 -r "Icons" -o ./icons --format svg
# PDF (vector)
exfig fetch -f abc123 -r "Icons" -o ./icons --format pdf
# JPG
exfig fetch -f abc123 -r "Photos" -o ./photos --format jpg
# WebP with quality
exfig fetch -f abc123 -r "Images" -o ./images --format webp --webp-quality 90
# WebP lossless
exfig fetch -f abc123 -r "Images" -o ./images --format webp --webp-encoding lossless
```
### Penpot Fetch
```bash
# Fetch icons from Penpot as SVG
exfig fetch --source penpot -f "a1b2c3d4-..." -r "Icons / App" -o ./icons --format svg
# Fetch as PNG at 3x scale (SVG reconstructed, then rasterized via resvg)
exfig fetch --source penpot -f "a1b2c3d4-..." -r "Icons" -o ./icons --format png --scale 3
# From a shared library (use library file ID)
exfig fetch --source penpot -f "library-uuid" -r "Icons / Actions" -o ./icons --format svg
# Self-hosted Penpot instance
exfig fetch --source penpot --penpot-base-url https://penpot.mycompany.com/ \
-f "uuid" -r "Icons" -o ./icons --format svg
```
> Set `PENPOT_ACCESS_TOKEN` environment variable (generate at Settings → Access Tokens).
> File ID is in the Penpot workspace URL: `?file-id=UUID`.
### Scale Options
```bash
# PNG at 2x scale
exfig fetch -f abc123 -r "Images" -o ./images --scale 2
# Note: Scale is ignored for vector formats (SVG, PDF)
```
### Filtering and Naming
```bash
# Filter specific images
exfig fetch -f abc123 -r "Images" -o ./images --filter "logo/*"
# Convert names to camelCase
exfig fetch -f abc123 -r "Images" -o ./images --name-style camelCase
# Custom regex replacement
exfig fetch -f abc123 -r "Images" -o ./images \
--name-validate-regexp "^icon/(.*)$" \
--name-replace-regexp "ic_$1"
```
### All Fetch Options
| Option | Short | Description | Default |
| -------------------- | ----- | -------------------------------------- | ------- |
| `--file-id` | `-f` | Figma file ID (required) | - |
| `--frame` | `-r` | Figma frame name (required) | - |
| `--page` | `-p` | Filter by Figma page name | - |
| `--output` | `-o` | Output directory (required) | - |
| `--format` | - | Image format: png, svg, jpg, pdf, webp | png |
| `--scale` | - | Scale factor (0.01-4.0) | 3 |
| `--filter` | - | Filter pattern | - |
| `--name-style` | - | Name style | - |
| `--dark-mode-suffix` | - | Suffix for dark variants | - |
| `--webp-encoding` | - | WebP encoding: lossy, lossless | lossy |
| `--webp-quality` | - | WebP quality (0-100) | 80 |
## Linting
Validate your Figma file structure against your PKL config before exporting:
```bash
# Lint with default rules
exfig lint -i exfig.pkl
# Add lint-only policies from a separate config
exfig lint -i exfig.pkl --lint-config lint.pkl
# Only check specific rules
exfig lint -i exfig.pkl --rules naming-convention,deleted-variables
# JSON output for CI (exit code 1 on errors)
exfig lint -i exfig.pkl --format json --severity error
```
### Available Rules
| Rule | Severity | Description |
| --------------------------- | -------- | ------------------------------------------------------ |
| `frame-page-match` | error | Frame/page names in config exist in Figma file |
| `naming-convention` | error | Component names match `nameValidateRegexp` patterns |
| `component-not-frame` | error | Configured frames contain published components |
| `duplicate-component-names` | error | No duplicate component names in configured frames |
| `deleted-variables` | warning | No `deletedButReferenced` variables in collections |
| `alias-chain-integrity` | warning | Variable alias chains resolve without broken refs |
| `dark-mode-variables` | error | With `variablesDarkMode`, fills bound to Variables |
| `dark-mode-suffix` | warning | With `suffixDarkMode`, light components have dark pair |
| `path-data-length` | error | Icon SVG pathData within 32,767-byte AAPT limit |
| `icon-color-variables` | error | Icon paints use configured Figma Variables |
## Help and Version
```bash
# Show help
exfig --help
exfig colors --help
# Show version
exfig --version
```
## See Also
- BatchProcessing
- DesignTokens
- MCPServer
- Configuration
- DesignRequirements
- iOS
- Android
- Flutter
### Configuration
# Configuration
Complete reference for exfig.pkl configuration options.
## Overview
ExFig uses a PKL configuration file (typically `exfig.pkl`) to define export settings. PKL (Programmable, Scalable, Safe)
provides type-safe configuration with IDE support. This document covers all available options.
## Configuration File
By default, ExFig looks for `exfig.pkl` in the current directory.
Specify a custom path with the `-i` flag:
```bash
exfig colors -i path/to/config.pkl
```
## Unified Config with Batch
A single `exfig.pkl` can contain all resource types. Use `batch` to export everything at once:
```bash
# Export all resource types from a single config
exfig batch exfig.pkl
# With version tracking
exfig batch exfig.pkl --cache
```
> Note: The `batch` command takes config paths as **positional arguments** (not via `-i` flag).
## Figma Section
```pkl showLineNumbers
import ".exfig/schemas/Figma.pkl"
figma = new Figma.FigmaConfig {
// Figma file ID for light mode assets.
// Required for icons, images, and typography export.
// Optional when using only variablesColors (or multi-entry colors) for colors export.
lightFileId = "ABC123xyz"
// Optional: Separate file for dark mode assets
darkFileId = "DEF456abc"
// Optional: API request timeout in seconds (default: 30)
timeout = 60
// Optional: API requests per minute (default: 10). CLI --rate-limit overrides.
rateLimit = 25
// Optional: Retry attempts for failed API requests (default: 4). CLI --max-retries overrides.
maxRetries = 6
// Optional: Concurrent CDN downloads — icons/images only (default: 20).
// Ignored by colors/typography. CLI --concurrent-downloads overrides.
// Client-side cap on connections (URLSession.httpMaximumConnectionsPerHost), not a Figma REST limit.
concurrentDownloads = 50
}
```
**Precedence (per knob):** CLI flag > PKL config > built-in default. The same rule applies to
all five fields above. CI workflows can keep one value here instead of repeating CLI flags
everywhere; ad-hoc invocations still override per-run.
## Common Section
Shared settings across all platforms.
### Colors
```pkl showLineNumbers
import ".exfig/schemas/Common.pkl"
common = new Common.CommonConfig {
colors = new Common.Colors {
// Frame name containing color styles (default: null, uses all styles)
figmaFrameName = "Colors"
// Regex to validate color names
nameValidateRegexp = "^[a-z][a-zA-Z0-9]*$"
// Regex replacement for color names
nameReplaceRegexp = "$1"
// suffixDarkMode = new Common.SuffixDarkMode { suffix = "_dark" }
}
}
```
### Variables Colors
```pkl showLineNumbers
import ".exfig/schemas/Common.pkl"
common = new Common.CommonConfig {
// Use variablesColors instead of colors to export colors from Figma Variables.
// Cannot be used together with colors.
variablesColors = new Common.VariablesColors {
// Identifier of the file containing variables
tokensFileId = "ABC123xyz"
// Variables collection name
tokensCollectionName = "Colors"
// Name of the column containing light color variables
lightModeName = "Light"
// Name of the column containing dark color variables
darkModeName = "Dark"
}
}
```
### Penpot Source
Use a Penpot project instead of Figma as the design source. For file preparation guidelines,
see DesignRequirements.
**Colors:**
```pkl
import ".exfig/schemas/Common.pkl"
import ".exfig/schemas/iOS.pkl"
ios = new iOS.iOSConfig {
colors = new iOS.ColorsEntry {
penpotSource = new Common.PenpotSource {
fileId = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
// baseUrl = "https://penpot.mycompany.com/" // optional: self-hosted
pathFilter = "Brand" // optional: filter by path prefix
}
assetsFolder = "Colors"
nameStyle = "camelCase"
}
}
```
**Icons:**
```pkl
ios = new iOS.iOSConfig {
icons = new Listing {
new iOS.IconsEntry {
penpotSource = new Common.PenpotSource {
fileId = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
// pathFilter = "Icons / Actions" // optional: filter by path prefix
}
figmaFrameName = "Icons" // path prefix filter (same field as Figma)
format = "svg" // svg or pdf — SVG reconstructed from shape tree
assetsFolder = "Icons"
nameStyle = "camelCase"
}
}
}
```
**Typography:**
```pkl
ios = new iOS.iOSConfig {
typography = new iOS.TypographyEntry {
penpotSource = new Common.PenpotSource {
fileId = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
}
}
```
> When `penpotSource` is set, `sourceKind` auto-detects as `"penpot"`. ExFig reads from
> the Penpot API and does not require `FIGMA_PERSONAL_TOKEN`. Set `PENPOT_ACCESS_TOKEN` instead.
>
> Icons and images are exported via **SVG reconstruction** from Penpot's shape tree —
> no headless Chrome needed. Supported formats: SVG, PNG (any scale), PDF, WebP.
### Tokens File Source
Use a local W3C DTCG `.tokens.json` file instead of the Figma Variables API:
```pkl
import ".exfig/schemas/Common.pkl"
import ".exfig/schemas/iOS.pkl"
ios = new iOS.iOSConfig {
colors = new iOS.ColorsEntry {
// Load colors from a local .tokens.json file
tokensFile = new Common.TokensFile {
// Path to the .tokens.json file
path = "./design-tokens/colors.tokens.json"
// Optional: filter to specific token group
groupFilter = "Brand.Colors"
}
assetsFolder = "Colors"
nameStyle = "camelCase"
}
}
```
> When `tokensFile` is set, ExFig reads color tokens from the local file and does not require `FIGMA_PERSONAL_TOKEN` or Figma Variables configuration (`tokensFileId`, `tokensCollectionName`, `lightModeName`).
### Icons
```pkl
import ".exfig/schemas/Common.pkl"
common = new Common.CommonConfig {
icons = new Common.Icons {
// Default frame name for icon components (can be overridden per-entry)
figmaFrameName = "Icons"
// Regex to validate icon names
nameValidateRegexp = "^ic/.*$"
// Regex replacement for icon names
nameReplaceRegexp = "ic_$1"
// suffixDarkMode = new Common.SuffixDarkMode { suffix = "_dark" }
}
}
```
### RTL (Right-to-Left) Configuration
Icons in a COMPONENT_SET can have an RTL variant property (e.g., `RTL=Off` and `RTL=On`).
The "active" variant is skipped during export — platforms mirror the base icon at runtime.
```pkl
new iOS.IconsEntry {
// Property name in Figma (default: "RTL")
rtlProperty = "RTL"
// Values meaning "active RTL" — these variants are skipped.
// Default: new { "On" } (paired with "Off")
rtlActiveValues = new { "On" }
// If your Figma uses true/false instead of On/Off:
// rtlActiveValues = new { "true" }
}
```
Set `rtlProperty = null` to disable RTL detection entirely.
The `exfig lint` rule `invalid-rtl-variant-value` validates that RTL variant values
match the configured `rtlActiveValues` and their known counterparts
(On↔Off, true↔false, True↔False, Yes↔No, 0↔1).
### Images
```pkl
import ".exfig/schemas/Common.pkl"
common = new Common.CommonConfig {
images = new Common.Images {
// Frame name containing image components
figmaFrameName = "Illustrations"
// Regex to validate image names
nameValidateRegexp = "^img_.*$"
// Regex replacement for image names
nameReplaceRegexp = "$1"
// suffixDarkMode = new Common.SuffixDarkMode { suffix = "_dark" }
}
}
```
### Typography
```pkl
import ".exfig/schemas/Common.pkl"
common = new Common.CommonConfig {
typography = new Common.Typography {
// Regex to validate style names
nameValidateRegexp = "^[a-z].*$"
}
}
```
## iOS Section
```pkl
import ".exfig/schemas/iOS.pkl"
ios = new iOS.iOSConfig {
// Path to Xcode project
xcodeprojPath = "./MyApp.xcodeproj"
// Target name for adding generated files
target = "MyApp"
// Path to Assets.xcassets
xcassetsPath = "./Resources/Assets.xcassets"
// Colors
colors = new iOS.ColorsEntry {
// Use color assets in xcassets
useColorAssets = true
// Folder in xcassets for colors
assetsFolder = "Colors"
// Naming style: camelCase, snake_case, PascalCase, kebab-case, SCREAMING_SNAKE_CASE
nameStyle = "camelCase"
// Group colors in subfolders by prefix
groupUsingNamespace = true
// UIKit extension output path
colorSwift = "./Sources/Generated/UIColor+Colors.swift"
// SwiftUI extension output path
swiftuiColorSwift = "./Sources/Generated/Color+Colors.swift"
}
// Icons
icons = new iOS.IconsEntry {
// Folder in xcassets for icons
assetsFolder = "Icons"
// Naming style
nameStyle = "camelCase"
// Icon format: pdf or svg
format = "pdf"
// Preserve vector data
preservesVectorRepresentation = new Listing {
"ic24TabBarMain"
"ic24TabBarEvents"
}
// UIKit extension output path
imageSwift = "./Sources/Generated/UIImage+Icons.swift"
// SwiftUI extension output path
swiftUIImageSwift = "./Sources/Generated/Image+Icons.swift"
}
// Images
images = new iOS.ImagesEntry {
// Folder in xcassets for images
assetsFolder = "Images"
// Naming style
nameStyle = "camelCase"
// Scales to export (default: [1, 2, 3])
scales = new Listing { 1; 2; 3 }
// UIKit extension output path
imageSwift = "./Sources/Generated/UIImage+Images.swift"
// SwiftUI extension output path
swiftUIImageSwift = "./Sources/Generated/Image+Images.swift"
}
// Typography
typography = new iOS.Typography {
// Generate labels with predefined styles
generateLabels = true
// Font extension output path
fontSwift = "./Sources/Generated/UIFont+Typography.swift"
// SwiftUI font extension output path
swiftUIFontSwift = "./Sources/Generated/Font+Typography.swift"
// UIKit label extension output path