import type { Token } from 'style-dictionary' import type { NameTransform } from 'style-dictionary/types' import { prefixTransform } from '../utils/prefix-transform' type Transformer = NameTransform['transform'] export function filter(token: Token): boolean { return token.$type === 'typography' } const tailwindTypographyTransform: Transformer = (token, config) => { const [_category, type, item] = token.path // Reorders the token path from [typography, h1, sm] // to the string "typography-sm-h1" const newPath = ['typography', item, type] return newPath.join('-') } export const transform = prefixTransform(tailwindTypographyTransform)