### Install ExFig using Mint Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/GettingStarted.md Installs the ExFig command-line tool using Mint, a dependency manager for Swift projects. This is an alternative installation method. ```bash mint install alexey1312/ExFig ``` -------------------------------- ### ExFig CLI Execution Examples Source: https://github.com/alexey1312/exfig/blob/main/AGENTS.md Examples of how to run the ExFig CLI tool for various functions, including exporting resources, fetching data, and downloading tokens. ```bash # Run CLI .build/debug/exfig --help .build/debug/exfig colors -i exfig.pkl .build/debug/exfig icons -i exfig.pkl .build/debug/exfig batch exfig.pkl # All resources from unified config (positional arg!) .build/debug/exfig fetch -f FILE_ID -r "Frame" -o ./output .build/debug/exfig download tokens -o tokens.json # Unified W3C design tokens ``` -------------------------------- ### Install Project Tools Source: https://github.com/alexey1312/exfig/blob/main/CLAUDE.md Command to set up and install necessary development tools for the project, often required before formatting or other development tasks can succeed. ```bash ./bin/mise run setup ``` -------------------------------- ### ExFig Configuration File Example (PKL) Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/GettingStarted.md An example of an `exfig.pkl` configuration file. It demonstrates how to import schemas and define settings for Figma and iOS exports, including file IDs and project paths. ```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 } ``` -------------------------------- ### Clone ExFig Repository Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/Development.md Clones the ExFig repository from GitHub and navigates into the project directory. This is the first step to start development. ```bash git clone https://github.com/alexey1312/ExFig.git cd ExFig ``` -------------------------------- ### ExFig Context Implementation Example Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/CLAUDE.md Shows how context implementations bridge CLI infrastructure to ExFigCore's export context protocols. This example for `IconsExportContextImpl` details how it handles loading, writing, UI feedback, and file downloading. ```swift IconsExportContextImpl → implements IconsExportContext .loadIcons() → creates IconsLoader, calls Figma API .writeFiles() → delegates to FileWriter .withSpinner() → delegates to TerminalUI .downloadFile() → delegates to FileDownloader / PipelinedDownloader ``` -------------------------------- ### AndroidOutput Configuration Example Source: https://github.com/alexey1312/exfig/blob/main/Sources/AndroidExport/CLAUDE.md Provides an example of the `AndroidOutput` configuration object, which bridges PKL configuration to exporter parameters. It specifies output directories and resource package information. ```kotlin data class AndroidOutput( val xmlOutputDirectory: String, val composeOutputDirectory: String, val xmlResourcePackage: String, val xmlDisabled: Boolean = false ) ``` -------------------------------- ### Web/React Configuration Example Source: https://context7.com/alexey1312/exfig/llms.txt Complete PKL configuration for exporting to Web/React projects with CSS variables and TypeScript. This example configures Figma, common variables, and specific outputs for colors, icons, and images tailored for web development. ```pkl amends ".exfig/schemas/ExFig.pkl" import ".exfig/schemas/Figma.pkl" import ".exfig/schemas/Common.pkl" import ".exfig/schemas/Web.pkl" figma = new Figma.FigmaConfig { lightFileId = "ABC123xyz" darkFileId = "DEF456abc" } common = new Common.CommonConfig { variablesColors = new Common.VariablesColors { tokensFileId = "ABC123xyz" tokensCollectionName = "Colors" lightModeName = "Light" darkModeName = "Dark" } icons = new Common.Icons { figmaFrameName = "Icons" } } web = new Web.WebConfig { output = "./src/tokens" colors = new Web.ColorsEntry { outputDirectory = "." cssFileName = "theme.css" tsFileName = "variables.ts" jsonFileName = "tokens.json" } icons = new Web.IconsEntry { outputDirectory = "./src/icons" svgDirectory = "assets/icons" generateReactComponents = true iconSize = 24 nameStyle = "PascalCase" } images = new Web.ImagesEntry { outputDirectory = "./src/images" assetsDirectory = "assets/images" generateReactComponents = true } } ``` -------------------------------- ### Install ExFig using Homebrew Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/GettingStarted.md Installs the ExFig command-line tool using the Homebrew package manager. This is the recommended installation method for macOS users. ```bash brew install alexey1312/tap/exfig ``` -------------------------------- ### Install ExFig using Mise Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/GettingStarted.md Installs and manages ExFig using Mise, a polyglot environment manager. This command ensures ExFig is available globally. ```bash mise use -g github:alexey1312/ExFig ``` -------------------------------- ### Run ExFig CLI Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/Development.md Executes the ExFig command-line interface. Demonstrates how to run it for both debug and release builds, including showing help information. ```bash # Debug build .build/debug/exfig --help # Release build swift build -c release .build/release/exfig --help ``` -------------------------------- ### Install ExFig from Source Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/GettingStarted.md Builds ExFig from its source code. This method involves cloning the repository, compiling the project using Swift, and copying the executable to the system's PATH. ```bash git clone https://github.com/alexey1312/ExFig.git cd ExFig swift build -c release cp .build/release/exfig /usr/local/bin/ ``` -------------------------------- ### Install ExFig using Homebrew, Mint, or Mise Source: https://github.com/alexey1312/exfig/blob/main/README.md This snippet shows how to install the ExFig command-line utility using different package managers: Homebrew, Mint, or Mise. Homebrew is recommended for ease of use. ```bash # Using Homebrew (recommended) brew install alexey1312/tap/exfig # Using Mint mint install alexey1312/ExFig # Using mise mise use -g github:alexey1312/ExFig ``` -------------------------------- ### Example `exfig.pkl` File Structure Source: https://github.com/alexey1312/exfig/blob/main/CONFIG.md Illustrates the basic structure of an `exfig.pkl` configuration file, including the `amends` declaration for the root schema and `import` statements for platform-specific modules. ```pkl amends ".exfig/schemas/ExFig.pkl" import ".exfig/schemas/Figma.pkl" import ".exfig/schemas/Common.pkl" import ".exfig/schemas/iOS.pkl" ``` -------------------------------- ### Flutter Configuration Example Source: https://context7.com/alexey1312/exfig/llms.txt Complete PKL configuration for exporting to Flutter projects with Dart code generation. This example sets up Figma integration, common variables for colors, icons, and images, and specific Flutter outputs for colors, icons, and images. ```pkl amends ".exfig/schemas/ExFig.pkl" import ".exfig/schemas/Figma.pkl" import ".exfig/schemas/Common.pkl" import ".exfig/schemas/Flutter.pkl" figma = new Figma.FigmaConfig { lightFileId = "ABC123xyz" darkFileId = "DEF456abc" } common = new Common.CommonConfig { variablesColors = new Common.VariablesColors { tokensFileId = "ABC123xyz" tokensCollectionName = "Colors" lightModeName = "Light" darkModeName = "Dark" } icons = new Common.Icons { figmaFrameName = "Icons" } images = new Common.Images { figmaFrameName = "Illustrations" } } flutter = new Flutter.FlutterConfig { output = "lib/generated" colors = new Flutter.ColorsEntry { output = "colors.dart" className = "AppColors" } icons = new Flutter.IconsEntry { output = "assets/icons" dartFile = "icons.dart" className = "AppIcons" nameStyle = "snake_case" } images = new Flutter.ImagesEntry { output = "assets/images" dartFile = "images.dart" className = "AppImages" format = "png" scales = new Listing { 1; 2; 3 } } } ``` -------------------------------- ### ExFig Initialization and Verification Source: https://github.com/alexey1312/exfig/blob/main/MIGRATION_FROM_FIGMA_EXPORT.md Steps to initialize ExFig with a new PKL configuration file and verify the configuration using PKL evaluation. ```bash exfig init -p pkl eval --format json exfig.pkl ``` -------------------------------- ### Specify Custom Configuration File Path Source: https://github.com/alexey1312/exfig/blob/main/CONFIG.md This example shows how to use the `-i` or `--input` flag to specify a custom path to your `exfig.pkl` configuration file, overriding the default search behavior. ```bash exfig colors -i ./configs/my-config.pkl ``` -------------------------------- ### Initialize ExFig Configuration for Platforms Source: https://github.com/alexey1312/exfig/blob/main/MIGRATION_FROM_FIGMA_EXPORT.md Initializes a new ExFig PKL configuration file for a specified platform. This command is used as the first step in migrating from figma-export to ExFig. ```bash exfig init -p ios # or android, flutter, web ``` -------------------------------- ### Run ExFig Tests Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/Development.md Executes the project's tests using either 'mise' or the Swift toolchain. Supports running all tests or filtering by specific test targets. ```bash # Using mise mise run test # Using Swift directly swift test ``` ```bash # Run specific test target swift test --filter ExFigCoreTests ``` -------------------------------- ### Build ExFig Project Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/Development.md Builds the ExFig project using either 'mise' for task running or directly with the Swift toolchain. Supports both debug and release builds. ```bash # Using mise mise run build # Using Swift directly swift build ``` ```bash # Release build mise run build:release ``` -------------------------------- ### Clean and Build Swift Project Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/Development.md Commands to clean the Swift Package Manager build artifacts and then build the project. This is typically used when encountering build failures. ```bash swift package clean swift build ``` -------------------------------- ### Add New CLI Command in Swift Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/Development.md Demonstrates how to add a new asynchronous command to the ExFig CLI using the ArgumentParser library. Includes creating the command struct and registering it. ```swift import ArgumentParser struct NewCommand: AsyncParsableCommand { static let configuration = CommandConfiguration( commandName: "new", abstract: "Description of the command" ) @OptionGroup var globalOptions: GlobalOptions @OptionGroup var cacheOptions: CacheOptions func run() async throws { // Implementation } } // In ExFigCommand.swift: static let configuration = CommandConfiguration( subcommands: [ // ... existing commands NewCommand.self ] ) ``` -------------------------------- ### Commit Message Examples Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/Development.md Examples of conventional commit messages used in the exfig project, demonstrating the format (): . ```bash feat(cli): add download command for config-free exports fix(icons): handle SVG with missing viewBox docs: update naming style documentation refactor(api): simplify rate limiting logic ``` -------------------------------- ### JSON Example for W3C Design Tokens Source: https://github.com/alexey1312/exfig/blob/main/MIGRATION_FROM_FIGMA_EXPORT.md An example of the JSON output format for W3C Design Tokens, showcasing color definitions with light and dark variants. ```json { "Background": { "Primary": { "$type": "color", "$value": { "Light": "#ffffff", "Dark": "#1a1a1a" } } } } ``` -------------------------------- ### PKL Multiple Mappings for Different Icon Groups Source: https://github.com/alexey1312/exfig/blob/main/CONFIG.md This PKL example shows how to use multiple `local` Mappings to manage different groups of categories that require distinct settings. It iterates through separate mappings (`allCategories` and `dcCategories`) to generate entries for different types of icons (e.g., template vs. double color) with specific configurations. ```pkl local allCategories: Mapping = new { /* 17 items */ } local dcCategories: Mapping = new { /* 15 items â2014 all except Logo, Template */ } icons = new Listing { // Template icons from allCategories for (frameName, folder in allCategories) { new iOS.IconsEntry { /* template settings */ } } // Double Color icons from dcCategories for (frameName, folder in dcCategories) { new iOS.IconsEntry { figmaFileId = "other-file"; renderMode = "default"; /* ... */ } } } ``` -------------------------------- ### iOS Colors Configuration with Multiple Tokens Collections (PKL) Source: https://github.com/alexey1312/exfig/blob/main/MIGRATION_FROM_FIGMA_EXPORT.md Illustrates configuring ExFig to export colors from multiple Figma tokens collections for iOS using PKL. This example shows how to define settings for different color palettes, including light and dark modes. ```pkl ios = new iOS.iOSConfig { // ... colors = new Listing { new iOS.ColorsEntry { tokensFileId = "abc123" tokensCollectionName = "Base Palette" lightModeName = "Light" darkModeName = "Dark" useColorAssets = true assetsFolder = "BaseColors" colorSwift = "./Generated/BaseColors.swift" } new iOS.ColorsEntry { tokensFileId = "def456" tokensCollectionName = "Theme Colors" lightModeName = "Light" useColorAssets = true assetsFolder = "ThemeColors" colorSwift = "./Generated/ThemeColors.swift" } } } ``` -------------------------------- ### Mix Manual and Generated Entries in PKL Listing Source: https://github.com/alexey1312/exfig/blob/main/CONFIG.md This PKL example illustrates how to combine manually defined entries with dynamically generated entries within the same `Listing`. This is useful for handling special cases with unique settings alongside a large set of entries generated from a mapping. ```pkl icons = new Listing { // Manual entries for special cases new iOS.IconsEntry { figmaFrameName = "Colored Icons" renderMode = "default" // ... } // Generated entries for categories with identical settings for (frameName, folder in iconCategories) { new iOS.IconsEntry { figmaFrameName = frameName assetsFolder = folder // ... } } } ``` -------------------------------- ### Run Swift Tests with Build Source: https://github.com/alexey1312/exfig/blob/main/CLAUDE.md Command to build Swift tests and then run them. This ensures tests are up-to-date before execution. ```bash swift build --build-tests && swift test --skip-build --parallel ``` -------------------------------- ### Kotlin Template Example: Custom Colors Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/CustomTemplates.md An example Jinja2 template for generating Kotlin color objects. It iterates over 'colors' and 'darkColors' to create Compose Color objects. ```jinja {{ header }} package {{ packageName }} import androidx.compose.ui.graphics.Color object AppColors { {% for color in colors %} val {{ color.name }} = Color(0x{{ color.hexARGB }}) {% endfor %} } object AppColorsDark { {% for color in darkColors %} val {{ color.name }} = Color(0x{{ color.hexARGB }}) {% endfor %} } ``` -------------------------------- ### Flutter Template Example: Custom Colors Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/CustomTemplates.md An example Jinja2 template for generating Dart color constants. It iterates over 'colors' and 'darkColors' to create Flutter Material Color constants. ```jinja {{ header }} import 'package:flutter/material.dart'; class {{ className }} { {{ className }}._(); {% for color in colors %} /// {{ color.originalName }} static const Color {{ color.name }} = Color({{ color.hex }}); {% endfor %} } class {{ className }}Dark { {{ className }}Dark._(); {% for color in darkColors %} static const Color {{ color.name }} = Color({{ color.hex }}); {% endfor %} } ``` -------------------------------- ### Initialize ExFig Configuration Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/GettingStarted.md Generates a starter configuration file (`exfig.pkl`) for ExFig based on the target platform (iOS, Android, or Flutter). This file is used to define export settings. ```bash # For iOS projects exfig init --platform ios ``` ```bash # For Android projects exfig init --platform android ``` ```bash # For Flutter projects exfig init --platform flutter ``` -------------------------------- ### Web Template Example: Custom theme.css Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/CustomTemplates.md An example Jinja2 template for generating CSS custom properties for themes. It includes light and dark color definitions and uses a media query for dark mode. ```jinja :root { {% for color in lightColors %} --{{ color.cssName }}: {{ color.value }}; {% endfor %} } {% if hasDarkColors %} @media (prefers-color-scheme: dark) { :root { {% for color in darkColors %} --{{ color.cssName }}: {{ color.value }}; {% endfor %} } } {% endif %} ``` -------------------------------- ### PKL Config Inheritance with Base and Project-Specific Files Source: https://context7.com/alexey1312/exfig/llms.txt Demonstrates how to create a base PKL configuration file with shared settings and extend it in a project-specific configuration file. This allows for modular and reusable configuration management. ```pkl // base.pkl - shared across teams amends ".exfig/schemas/ExFig.pkl" import ".exfig/schemas/Figma.pkl" import ".exfig/schemas/Common.pkl" figma = new Figma.FigmaConfig { lightFileId = "design-system-light" darkFileId = "design-system-dark" timeout = 60 } common = new Common.CommonConfig { cache = new Common.Cache { enabled = true } variablesColors = new Common.VariablesColors { tokensFileId = "design-tokens-file" tokensCollectionName = "Design System" lightModeName = "Light" darkModeName = "Dark" } icons = new Common.Icons { figmaFrameName = "Icons/24" } } ``` ```pkl // exfig.pkl - project-specific, inherits from base amends "base.pkl" import ".exfig/schemas/iOS.pkl" ios = new iOS.iOSConfig { xcodeprojPath = "MyApp.xcodeproj" target = "MyApp" xcassetsPath = "MyApp/Resources/Assets.xcassets" xcassetsInMainBundle = true colors = new iOS.ColorsEntry { useColorAssets = true assetsFolder = "Colors" nameStyle = "camelCase" } icons = new iOS.IconsEntry { format = "pdf" assetsFolder = "Icons" nameStyle = "camelCase" } } ``` -------------------------------- ### Show Help with exfig Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/Usage.md These commands display the help information for the exfig CLI. '--help' can be used globally or with specific subcommands. ```bash # Show help exfig --help exfig colors --help ``` -------------------------------- ### Generated iOS Swift Code for Color and Image Access Source: https://context7.com/alexey1312/exfig/llms.txt Illustrates the Swift extensions generated by ExFig for type-safe access to colors and images within iOS applications. It shows examples for both UIKit and SwiftUI, along with a usage example in a SwiftUI ContentView. ```swift // UIColor+Colors.swift (Generated by ExFig) import UIKit extension UIColor { static var primary: UIColor { UIColor(named: "primary")! } static var secondary: UIColor { UIColor(named: "secondary")! } static var textPrimary: UIColor { UIColor(named: "text/primary")! } static var backgroundPrimary: UIColor { UIColor(named: "background/primary")! } } // Color+Colors.swift (Generated by ExFig) import SwiftUI extension Color { static var primary: Color { Color("primary") } static var secondary: Color { Color("secondary") } static var textPrimary: Color { Color("text/primary") } static var backgroundPrimary: Color { Color("background/primary") } } // Usage in SwiftUI struct ContentView: View { var body: some View { VStack { Text("Hello") .foregroundColor(.textPrimary) Rectangle() .fill(Color.primary) Button("Action") { } // Button action .tint(.primary) } .background(Color.backgroundPrimary) } } ``` -------------------------------- ### Android Configuration Example with PKL Source: https://context7.com/alexey1312/exfig/llms.txt Complete PKL configuration for exporting design tokens to Android projects, supporting Jetpack Compose and XML resources. This configuration defines paths for Android resources and generated Kotlin files for colors, icons, images, and typography. ```pkl amends ".exfig/schemas/ExFig.pkl" import ".exfig/schemas/Figma.pkl" import ".exfig/schemas/Common.pkl" import ".exfig/schemas/Android.pkl" figma = new Figma.FigmaConfig { lightFileId = "ABC123xyz" darkFileId = "DEF456abc" } common = new Common.CommonConfig { icons = new Common.Icons { figmaFrameName = "Icons" nameValidateRegexp = "^ic/(.*)$" nameReplaceRegexp = "ic_$1" } } android = new Android.AndroidConfig { mainRes = "./app/src/main/res" resourcePackage = "com.example.app" mainSrc = "./app/src/main/java" colors = new Android.ColorsEntry { xmlOutputFileName = "figma_colors.xml" composePackageName = "com.example.app.ui.theme" } icons = new Android.IconsEntry { output = "exfig-icons" composePackageName = "com.example.app.ui.icons" pathPrecision = 4 strictPathValidation = true } images = new Android.ImagesEntry { format = "webp" output = "exfig-images" scales = new Listing { 1; 1.5; 2; 3; 4 } webpOptions = new Common.WebpOptions { encoding = "lossy" quality = 90 } } typography = new Android.Typography { nameStyle = "camelCase" composePackageName = "com.example.app.ui.typography" } } ``` -------------------------------- ### Build and Test Commands for ExFig-Android Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFig-Android/CLAUDE.md Provides commands for running integration and unit tests, as well as building the entire ExFig-Android project. These commands utilize the 'mise' tool for managing environments and running scripts. ```bash ./bin/mise run test:filter ExFig_AndroidTests ./bin/mise run test:filter AndroidExportTests ./bin/mise run build ``` -------------------------------- ### Build and Test Commands for ExFig-iOS Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFig-iOS/CLAUDE.md Provides commands to run integration tests, unit tests for the rendering layer, and a full project build using the 'mise' tool. These commands are essential for verifying the functionality and integrity of the ExFig-iOS project. ```bash ./bin/mise run test:filter ExFig_iOSTests ./bin/mise run test:filter XcodeExportTests ./bin/mise run build ``` -------------------------------- ### Format Code with Mise Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/Development.md Commands to set up development tools and format the codebase using the 'mise' task runner. This is part of the troubleshooting process for formatting issues. ```bash mise run setup # Install tools mise run format ``` -------------------------------- ### Batch Export All Resource Types with exfig Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/Configuration.md Shows how to use the `batch` command in ExFig to export all resource types defined in a single `exfig.pkl` file. It also includes an option for version tracking with `--cache`. ```bash # Export all resource types from a single config exfig batch exfig.pkl # With version tracking exfig batch exfig.pkl --cache ``` -------------------------------- ### Initialize PKL Configuration with exfig CLI Source: https://github.com/alexey1312/exfig/blob/main/MIGRATION.md Use the 'exfig init' command to quickly generate a new PKL configuration file for a specific platform (iOS, Android, Flutter, Web). This command sets up the basic structure and necessary imports. ```bash exfig init -p ios exfig init -p android exfig init -p flutter exfig init -p web ``` -------------------------------- ### Using Generated Images in Flutter Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/Flutter/Flutter.md Example of how to use the generated image constants in a Flutter application. It demonstrates displaying an image using its asset path and specifying its width. ```dart import 'package:your_app/generated/images.dart'; Image.asset( AppImages.logo, width: 200, ) ``` -------------------------------- ### Format Code with Mise Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/Development.md Formats Swift and Markdown code using 'mise' to ensure consistent code style across the project. This is part of the code quality checks. ```bash # Format Swift code mise run format # Format Markdown mise run format-md ``` -------------------------------- ### Execute Swift Tests with Pkl in PATH Source: https://github.com/alexey1312/exfig/blob/main/CLAUDE.md Command to execute Swift tests using a specific mise environment, ensuring the correct Pkl version is available in the PATH. This is crucial for tests relying on newer Pkl features. ```bash ./bin/mise exec -- swift test ``` -------------------------------- ### ExFig CLI Documentation and Coverage Commands Source: https://github.com/alexey1312/exfig/blob/main/AGENTS.md Commands for generating and previewing documentation, as well as running tests with coverage reports. ```bash # Docs & Coverage ./bin/mise run docs # Generate DocC documentation ./bin/mise run docs:preview # Preview docs in browser ./bin/mise run coverage # Run tests with coverage report ``` -------------------------------- ### ExFig Name Styling Options Source: https://github.com/alexey1312/exfig/blob/main/MIGRATION_FROM_FIGMA_EXPORT.md ExFig provides additional name style options for exporting assets, including camelCase, snake_case, PascalCase, kebab-case, and SCREAMING_SNAKE_CASE. ```bash # Example usage would depend on specific export commands, but these are the supported styles: camelCase snake_case PascalCase kebab-case SCREAMING_SNAKE_CASE ``` -------------------------------- ### Run ExFig Exports Source: https://github.com/alexey1312/exfig/blob/main/MIGRATION_FROM_FIGMA_EXPORT.md Executes export commands using a specified PKL configuration file. These commands correspond to the export functionalities previously available in figma-export. ```bash exfig colors -i exfig.pkl exfig icons -i exfig.pkl exfig images -i exfig.pkl ``` -------------------------------- ### iOS Configuration Example with PKL Source: https://context7.com/alexey1312/exfig/llms.txt Complete PKL configuration for exporting design tokens to iOS/Xcode projects, supporting both SwiftUI and UIKit. This configuration specifies paths for Xcode projects, assets, and generated Swift files for colors, icons, images, and typography. ```pkl amends ".exfig/schemas/ExFig.pkl" import ".exfig/schemas/Figma.pkl" import ".exfig/schemas/Common.pkl" import ".exfig/schemas/iOS.pkl" figma = new Figma.FigmaConfig { lightFileId = "ABC123xyz" darkFileId = "DEF456abc" timeout = 60 } common = new Common.CommonConfig { cache = new Common.Cache { enabled = true path = ".exfig-cache.json" } variablesColors = new Common.VariablesColors { tokensFileId = "ABC123xyz" tokensCollectionName = "Colors" lightModeName = "Light" darkModeName = "Dark" } icons = new Common.Icons { figmaFrameName = "Icons" } images = new Common.Images { figmaFrameName = "Illustrations" } } ios = new iOS.iOSConfig { xcodeprojPath = "./MyApp.xcodeproj" target = "MyApp" xcassetsPath = "./Resources/Assets.xcassets" xcassetsInMainBundle = true colors = new iOS.ColorsEntry { useColorAssets = true assetsFolder = "Colors" nameStyle = "camelCase" groupUsingNamespace = true colorSwift = "./Sources/Generated/UIColor+Colors.swift" swiftuiColorSwift = "./Sources/Generated/Color+Colors.swift" } icons = new iOS.IconsEntry { format = "pdf" assetsFolder = "Icons" nameStyle = "camelCase" preservesVectorRepresentation = new Listing { "ic24TabBarMain" "ic24TabBarEvents" } imageSwift = "./Sources/Generated/UIImage+Icons.swift" swiftUIImageSwift = "./Sources/Generated/Image+Icons.swift" } images = new iOS.ImagesEntry { assetsFolder = "Images" nameStyle = "camelCase" scales = new Listing { 1; 2; 3 } imageSwift = "./Sources/Generated/UIImage+Images.swift" swiftUIImageSwift = "./Sources/Generated/Image+Images.swift" } typography = new iOS.Typography { generateLabels = true labelsDirectory = "./Sources/Generated/Labels/" fontSwift = "./Sources/Generated/UIFont+Typography.swift" swiftUIFontSwift = "./Sources/Generated/Font+Typography.swift" nameStyle = "camelCase" } } ``` -------------------------------- ### Jinja Comment Example Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/CustomTemplates.md Shows how to include comments within Jinja templates. Comments are ignored during template rendering and are useful for explaining template logic or providing notes. ```jinja {# This is a comment #} ``` -------------------------------- ### Download Images with exfig Fetch (Short Options) Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/Usage.md This demonstrates using short options for the exfig fetch command to download images. It requires a file ID, frame name, and output directory. ```bash # Using short options exfig fetch -f YOUR_FILE_ID -r "Icons" -o ./icons ``` -------------------------------- ### Jinja Conditionals Example Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/CustomTemplates.md Demonstrates the use of conditional statements in Jinja templating. Supports if, elif, and else clauses for controlling template logic based on specified conditions. ```jinja {% if condition %} ... {% elif otherCondition %} ... {% else %} ... {% endif %} ``` -------------------------------- ### Clean and Build Swift Project Source: https://github.com/alexey1312/exfig/blob/main/CLAUDE.md Command to clean the Swift package and rebuild the project. This is useful when encountering build-related issues. ```bash swift package clean && swift build ``` -------------------------------- ### Load Test Fixture in Swift Source: https://github.com/alexey1312/exfig/blob/main/Sources/ExFigCLI/ExFig.docc/Development.md Loads API response fixtures from JSON files for testing purposes. This allows for reproducible tests without relying on live API calls. ```swift let fixture = try TestFixture.load("colors.json") ``` -------------------------------- ### PKL String Interpolation for Dynamic Paths Source: https://github.com/alexey1312/exfig/blob/main/CONFIG.md This snippet showcases PKL's string interpolation feature using `\(expr)`. It demonstrates how to dynamically construct file paths and folder names by embedding variables directly within strings, making configurations more flexible and data-driven. ```pkl imageSwift = "./Generated/\(folder)Icons.generated.swift" assetsFolder = "\(folder)Dc" // e.g., "ActionsDc" ```