-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathbuild.mjs
More file actions
97 lines (92 loc) · 2.26 KB
/
build.mjs
File metadata and controls
97 lines (92 loc) · 2.26 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import { StyleDictionary as SD } from "../dist/index.js";
const MySD = new SD({
log: {
warnings: "warn", // 'warn' | 'error' | 'disabled'
verbosity: "verbose", // 'default' | 'silent' | 'verbose'
errors: {
brokenReferences: "throw", // 'throw' | 'console'
},
},
});
const addPlatforms = (outdir) => {
return {
cssAdvanced: {
prefix: "PREFIX",
buildPath: `${outdir}/css/`,
preprocessors: ["extract-letterSpacing-preprocessor"],
// transformGroup: "css/extended",
transforms: [
'name/kebab',
'w3c-color/css',
'w3c-border/css',
'dimension/css',
'duration/css',
'cubicBezier/css',
'transition/css',
'fontWeight/css',
'fontFamily/css',
'typography/css',
'gradient/css',
'shadow/css',
'strokeStyle/css',
],
files: [
{
format: "css/advanced",
destination: "advanced-variables.css",
options: {
outputReferences: true,
}
},
],
},
// commonJs: {
// prefix: "PREFIX",
// buildPath: `${outdir}/js/`,
// transformGroup: "js",
// files: [
// {
// format: "javascript/commonJs",
// destination: "commonJs.js",
// options: {
// outputReferences: true,
// }
// },
// ],
// },
// esm: {
// prefix: "PREFIX",
// buildPath: `${outdir}/js/`,
// transformGroup: "js",
// files: [
// {
// format: "javascript/esm",
// destination: "esm.mjs",
// options: {
// outputReferences: true,
// }
// },
// ],
// },
// esmDeclaration: {
// prefix: "PREFIX",
// buildPath: `${outdir}/js/`,
// transformGroup: "js",
// files: [
// {
// format: "typescript/esm-declarations",
// destination: "esm.d.ts",
// options: {
// outputReferences: true,
// }
// },
// ],
// }
}
}
let extendSd = await MySD.extend({
source: ["./tests/tokens/*.json5"],
platforms: addPlatforms('./tests/dist/local'),
})
await extendSd.cleanAllPlatforms();
await extendSd.buildAllPlatforms();