forked from figma/variables-github-action-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.style-dictionary.js
73 lines (66 loc) · 1.5 KB
/
config.style-dictionary.js
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import StyleDictionary from 'style-dictionary';
// Custom format for Figma tokens
StyleDictionary.registerFormat({
name: 'figmaTokens',
format: function({ dictionary, platform }) {
return JSON.stringify(dictionary.tokens, null, 2);
}
});
// Custom transform for color values
StyleDictionary.registerTransform({
name: 'color/figmaRGBA',
type: 'value',
matcher: function(token) {
return token.type === 'color';
},
transform: function(token) {
// Transform color values as needed
return token.value;
}
});
export default {
source: ['tokens/*01*.json'], // 'tokens/*09*.json'],
platforms: {
scss: {
transformGroup: 'scss',
buildPath: 'build/scss/',
files: [{
destination: '_variables.scss',
format: 'scss/variables'
}]
},
/*
css: {
transformGroup: 'css',
buildPath: 'build/css/',
files: [{
destination: 'variables.css',
format: 'css/variables'
}]
},
js: {
transformGroup: 'js',
buildPath: 'build/js/',
files: [{
destination: 'variables.js',
format: 'javascript/es6'
}]
},
ios: {
transformGroup: 'ios',
buildPath: 'build/ios/',
files: [{
destination: 'Variables.swift',
format: 'ios-swift/class.swift'
}]
},
android: {
transformGroup: 'android',
buildPath: 'build/android/',
files: [{
destination: 'colors.xml',
format: 'android/colors'
}]
}, */
}
};