Skip to content

Το pantoken CLI

@pantoken/cli παρέχει pantoken generate <target>, το οποίο γράφει την πηγή των token σε ένα στόχο αποθετηρίου. Χρησιμοποιείται όταν μια πλατφόρμα χρειάζεται παραγόμενο κώδικα αντί για runtime εξάρτηση — native εφαρμογές, θέματα CMS και static-site generators.

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

Στόχοι

TargetOutput
swiftSwift source under Sources/<name> plus a Package.swift SwiftPM manifest stub.
androidAndroid XML resource files.
composeA Jetpack Compose Kotlin file.
flutterA Flutter Dart file.
rustA tokens.rs for egui (default) or iced (--format iced).
wordpressA block-theme theme.json.
vanillaA Vanilla Forums variables.json.
drupalDrupal theme assets.
jekyllJekyll site data.
hugoHugo site data.
swatchesColor swatches — ase (default), gpl, sketch, or svg via --format.
icon-fontAn icon web font (TTF, WOFF2), its CSS, and a codepoints map.
pendoThe Instructure-styled global.css for Pendo guides.

Συνήθεις παράμετροι

  • --out <dir> — όπου θα γραφτεί (προεπιλογή ./pantoken-out).
  • --theme <name>rebrand (προεπιλογή), canvas, ή canvasHighContrast.
  • --icons a,b,c — ονόματα εικονιδίων που θα παραχθούν ως native assets, για στόχους που τα υποστηρίζουν.
  • --class <Name> — το παραγόμενο όνομα τύπου ή πακέτου, για στόχους που το χρειάζονται.
  • --format <fmt> — η μορφή εξόδου, για swatches και rust.

Παραδείγματα

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

Πολλοί στόχοι επίσης εκθέτουν μια απλή συνάρτηση, ώστε να μπορείτε να τους καλέσετε από το δικό σας build αντί για το CLI. Δείτε την API reference για κάθε πακέτο πλατφόρμας.