Skip to content

pantoken-root / formats/stylus/src / toStylus

Fonksiyon: toStylus() ​

toStylus(tokens, options?): string

Deneysel

Bir token IR'si için Stylus değişkenleri oluştur.

Parametreler ​

tokens ​

salt okunur Token[]

IR (ör. @pantoken/tokens'den).

options? ​

ToStylusOptions = {}

ToStylusOptions.

Döndürür ​

string

Stylus kaynak dizesi.

Örnekler ​

Varsayılan (açık) değişkenleri oluştur

ts
import { toStylus } from "@pantoken/stylus";
import { tokens } from "@pantoken/tokens";

toStylus(tokens); // "instui-color-brand = #0374b5\n…"

Başka bir temanın koyu modunu çözümle

ts
import { toStylus } from "@pantoken/stylus";
import { byTheme } from "@pantoken/tokens";

toStylus(byTheme("canvas"), { mode: "dark" });