From e23ab66287470d1c37aa8e634a10bff206a7e7cc Mon Sep 17 00:00:00 2001 From: Michael Marszalek Date: Mon, 17 Jun 2024 12:43:51 +0200 Subject: [PATCH] tweaked transformer --- packages/cli/src/tokens/transformers.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/cli/src/tokens/transformers.ts b/packages/cli/src/tokens/transformers.ts index 5f0e7aeda6..b6a08145f0 100644 --- a/packages/cli/src/tokens/transformers.ts +++ b/packages/cli/src/tokens/transformers.ts @@ -2,7 +2,7 @@ import * as R from 'ramda'; import type { Transform } from 'style-dictionary/types'; import { noCase } from './utils/noCase'; -import { getValue } from './utils/utils'; +import { getValue, typeEquals } from './utils/utils'; const isPx = R.test(/\b\d+px\b/g); @@ -10,7 +10,7 @@ export const sizeRem: Transform = { name: 'ds/size/toRem', type: 'value', transitive: true, - filter: (token) => ['sizing', 'spacing', 'borderRadius'].includes(token.type as string), + filter: (token) => typeEquals(['sizing', 'spacing', 'borderRadius', 'fontsizes'], token), transform: (token, config) => { const value = getValue(token); @@ -51,12 +51,8 @@ export const typographyShorthand: Transform = { type: 'value', transitive: true, filter: (token) => token.type === 'typography', - transform: (token, config) => { + transform: (token) => { const typography = getValue(token); - - const baseFontPx = (config.basePxFontSize as unknown as number) || 16; - const fontSize = `${parseInt(typography.fontSize) / baseFontPx}rem`; - - return `${typography.fontWeight} ${fontSize}/${typography.lineHeight} '${typography.fontFamily}'`; + return `${typography.fontWeight} ${typography.fontSize}/${typography.lineHeight} '${typography.fontFamily}'`; }, };