Skip to content

L'interfaccia a riga di comando di pantoken

@pantoken/cli fornisce pantoken generate <target>, che scrive la sorgente dei token in un repository di destinazione. Usalo quando una piattaforma richiede codice generato anziché una dipendenza a runtime — app native, temi CMS e generatori di siti statici.

sh
npx pantoken generate <target> --out <dir> [--theme <name>] [--icons a,b,c]

Destinazioni

DestinazioneUscita
swiftSorgente Swift sotto Sources/<name> più uno stub di manifest SwiftPM Package.swift.
androidFile di risorse Android XML.
composeUn file Kotlin per Jetpack Compose.
flutterUn file Dart per Flutter.
rustUn tokens.rs per egui (predefinito) o iced (--format iced).
wordpressUn theme.json per block-theme.
vanillaUn variables.json per Vanilla Forums.
drupalAsset per temi Drupal.
jekyllDati per siti Jekyll.
hugoDati per siti Hugo.
swatchesTavolozze colore — ase (predefinito), gpl, sketch o svg tramite --format.
icon-fontUn font web di icone (TTF, WOFF2), il suo CSS e una mappa dei codepoint.
pendoL'global.css in stile Instructure per le guide Pendo.

Opzioni comuni

  • --out <dir> — dove scrivere (predefinito ./pantoken-out).
  • --theme <name>rebrand (predefinito), canvas o canvasHighContrast.
  • --icons a,b,c — nomi delle icone da emettere come asset nativi, per le destinazioni che le supportano.
  • --class <Name> — il tipo o nome del package generato, per le destinazioni che ne hanno bisogno.
  • --format <fmt> — il formato di uscita, per swatches e rust.

Esempi

sh
# iOS tokens plus two icons, in the Canvas theme.
npx pantoken generate swift --out ./ios/Tokens --theme canvas --icons arrow-left,check-mark

# A WordPress block theme's theme.json.
npx pantoken generate wordpress --out ./wp-content/themes/mytheme

# An egui palette for a Rust app.
npx pantoken generate rust --out ./src/tokens.rs --format egui

Diverse destinazioni espongono anche una funzione semplice, così puoi chiamarle dal tuo build anziché usare la CLI. Vedi la riferimento API per ogni package di piattaforma.