-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
29 lines (25 loc) · 856 Bytes
/
build.js
File metadata and controls
29 lines (25 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const StyleDictionary = require('style-dictionary');
StyleDictionary.registerTransform({
name: 'font/swift/lineHeightToCGFloat',
type: 'value',
matcher: function(prop) {
return (prop.attributes.category === 'font' && prop.attributes.type === 'line-height')
},
transformer: function(prop) {
const val = Number.parseFloat(prop.original.value);
return `CGFloat(${(val.toFixed(2))})`;
}
});
StyleDictionary.registerTransform({
name: 'time/swift/millisecondsToTimeInterval',
type: 'value',
matcher: function(prop) {
return (prop.attributes.category === 'time')
},
transformer: function(prop) {
const val = Number.parseFloat(prop.original.value) / 1000;
return `TimeInterval(${val})`;
}
});
StyleDictionaryExtended = StyleDictionary.extend(__dirname + '/config.json');
StyleDictionaryExtended.buildAllPlatforms();