-
Notifications
You must be signed in to change notification settings - Fork 161
/
config.js
63 lines (62 loc) · 1.84 KB
/
config.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
import tokens from './src/index.js';
export default {
source: ['src/**/*.json'],
platforms: {
js: {
transformGroup: 'js',
buildPath: 'dist/',
files: tokens.map((tokenCategory) => ({
destination: `${tokenCategory}.js`,
format: 'camelCase',
filter: (token) => token.filePath.includes(tokenCategory),
})),
},
json: {
transformGroup: 'js',
buildPath: 'dist/',
files: tokens.map((tokenCategory) => {
const customFormat = `custom/${tokenCategory}-json`;
return {
destination: `${tokenCategory}.json`,
format:
tokenCategory === 'breakpoints' || tokenCategory === 'colors'
? customFormat
: 'json/nested',
filter: (token) =>
// console.log(token.filePath.includes(tokenCategory), tokenCategory);
token.filePath.includes(tokenCategory),
};
}),
},
mjs: {
transformGroup: 'custom/mjs',
buildPath: 'dist/',
files: tokens.map((tokenCategory) => {
if (tokenCategory === 'colors') {
return {
destination: `${tokenCategory}.mjs`,
format: 'custom/colors-mjs',
filter: (token) => token.filePath.includes(tokenCategory),
};
}
return {
destination: `${tokenCategory}.mjs`,
format: 'custom/mjs',
filter: (token) => token.filePath.includes(tokenCategory),
};
}),
},
scss: {
transformGroup: 'scss',
buildPath: 'dist/',
files: tokens.map((tokenCategory) => ({
destination: `${tokenCategory}.scss`,
format:
tokenCategory === 'typography'
? 'custom/typography-scss'
: 'custom/scss',
filter: (token) => token.filePath.includes(tokenCategory),
})),
},
},
};