Skip to content

Commit d719f43

Browse files
allow for tokens of type number in figma export (#903)
1 parent 50890c6 commit d719f43

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/formats/jsonFigma.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const getFigmaType = (type: string): string => {
2828
color: 'COLOR',
2929
dimension: 'FLOAT',
3030
fontWeight: 'FLOAT',
31+
number: 'FLOAT',
3132
fontFamily: 'STRING',
3233
}
3334
if (type in validTypes) return validTypes[type as keyof typeof validTypes]

src/platforms/figma.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import type {PlatformInitializer} from '../types/PlatformInitializer'
33
import {isSource} from '../filters'
44

55
const validFigmaToken = (token: StyleDictionary.TransformedToken) => {
6-
const validTypes = ['color', 'dimension', 'shadow', 'fontWeight', 'fontFamily']
6+
const validTypes = ['color', 'dimension', 'shadow', 'fontWeight', 'fontFamily', 'number']
77
// is a siource token, not an included one
88
if (!isSource(token)) return false
9+
10+
if (`${token.value}`.substring(token.value.length - 2) === 'em') return false
911
// has a collection attribute
1012
if (
1113
!('$extensions' in token) ||

0 commit comments

Comments
 (0)