Skip to content

pantoken / packages/core/src / cssSyntaxForValue

Mahi: cssSyntaxForValue()

cssSyntaxForValue(value): string

Beta

Tūtaki ki te CSS @property syntax e rehitatia ana e tētahi token motuhake. Kāore ngā type o Tokens Studio e taurite 1:1 ki te wetereo CSS, nō reira ka arotakengia te uara. Ka hoki mai i te "*" (whānui) mō ngā mea kāore he token kotahi, motuhake, ā-tauira whakahaere.

Ngā Tawhā

value

string

He uara motuhake (kāore he var() / light-dark()).

Whakahokia

string

Te whakamārama wetereo mō te @property.

Ngā tauira

Ngā uara token kotahi kua tāipētia

ts
import { cssSyntaxForValue } from "@pantoken/core";

cssSyntaxForValue("#03893D"); // → "<color>"
cssSyntaxForValue("2px");     // → "<length>"
cssSyntaxForValue("50%");     // → "<percentage>"
cssSyntaxForValue("400");     // → "<integer>"

Ka hokinga ngā wāhanga e pā ana ki te momotuhi me ngā uara matatini ki te whānuitanga

ts
import { cssSyntaxForValue } from "@pantoken/core";

cssSyntaxForValue("1rem");                     // → "*" (rem isn't computationally independent)
cssSyntaxForValue("Lato, Helvetica, sans-serif"); // → "*"
cssSyntaxForValue("currentColor");             // → "*"