convert-dimension
This parser helps you convert units of dimension tokens (spacing, sizing, breakpoint, blur...) and composite tokens sub values (font-size, letter-spacing, border-width...)
Interface
interface parser {
name: 'convert-dimension';
options: {
toFormat:
| '%'
| 'px'
| 'em'
| 'rem'
| 'pt'
| 'pc'
| 'in'
| 'cm'
| 'mm'
| 'ex'
| 'cap'
| 'ch'
| 'ic'
| 'lh'
| 'rlh'
| 'vw'
| 'svw'
| 'lvw'
| 'dvw'
| 'vh'
| 'svh'
| 'lvh'
| 'dvh'
| 'vi'
| 'svi'
| 'lvi'
| 'dvi'
| 'vb'
| 'svb'
| 'lvb'
| 'dvb'
| 'vmin'
| 'svmin'
| 'lvmin'
| 'dvmin'
| 'vmax'
| 'svmax'
| 'lvmax'
| 'dvmax'
| null;
baseValue?: {
rem?: number
};
applyTo?: SDTFQuery;
applyToKeys?: {
textStyle?: Array<'fontSize' | 'lineHeight' | 'letterSpacing' | 'paragraphSpacing'| 'textIndent'>,
shadow?: Array<'offsetX' | 'offsetY' | 'blurRadius' | 'spreadRadius'>,
border?: Array<'width' | 'rectangleCornerRadii'>,
};
excludeFormats?: array;
includeFormats?: array;
};
}Options
Parameter
Required
Type
Default
Description
Examples
Basic usage
Generate unitless dimension tokens
Convert text style's font-size from px to rem
Last updated
Was this helpful?