Skip to content

Commit bba0263

Browse files
author
Stephanie Zeng
committed
chore: adding example template for transformation
1 parent b957b1f commit bba0263

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

packages/foundations/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
"./styles": "./index.css"
99
},
1010
"scripts": {
11-
"build": "radius-toolkit generate tokens.json -o styles/index.css"
11+
"build": "radius-toolkit generate tokens.json -o styles/index.css",
12+
"build:custom": "radius-toolkit generate tokens.json -c myCustomTemplate -T ./templates -o styles/vector.json",
13+
"build:tailwind": "radius-toolkit generate tokens.json -t tailwind"
1214
},
1315
"keywords": [],
1416
"author": "",
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { TemplateModule } from "radius-toolkit";
2+
3+
export default {
4+
name: "my-custom-template",
5+
render: ({ layers, vectors }, options) => {
6+
const transformed = vectors?.map(({ name, properties, source }) => {
7+
return {
8+
name,
9+
properties: JSON.stringify(properties),
10+
source,
11+
};
12+
});
13+
return Buffer.from(`${JSON.stringify(transformed)}`);
14+
},
15+
} satisfies TemplateModule;

0 commit comments

Comments
 (0)