-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
.figmaexportrc-native.example.ts
61 lines (57 loc) · 1.74 KB
/
.figmaexportrc-native.example.ts
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
/**
* If you want to try this configuration you can just run:
* $ npm install --save-dev typescript ts-node @types/node @figma-export/types
* $ npm install --save-dev @figma-export/transform-svg-with-svgo @figma-export/output-components-as-svgr
* $ npm install --save-dev @svgr/plugin-svgo @svgr/plugin-jsx @svgr/plugin-prettier
* */
import { FigmaExportRC, ComponentsCommandOptions } from "@figma-export/types";
import transformSvgWithSvgo from "@figma-export/transform-svg-with-svgo";
import transformSvgWithSvgr from "@figma-export/output-components-as-svgr";
const componentOptions: ComponentsCommandOptions = {
fileId: "fzYhvQpqwhZDUImRz431Qo",
// version: 'xxx123456', // optional - file's version history is only supported on paid Figma plans
onlyFromPages: ["icons"],
transformers: [
transformSvgWithSvgo({
plugins: [
{
name: "preset-default",
params: {
overrides: {
removeViewBox: false,
},
},
},
{
name: "removeXMLNS",
},
],
}),
],
outputters: [
transformSvgWithSvgr({
output: "./output",
getFileExtension: () => ".tsx",
getSvgrConfig: () => ({
expandProps: "end",
icon: true,
native: true,
plugins: [
"@svgr/plugin-svgo",
"@svgr/plugin-jsx",
"@svgr/plugin-prettier",
],
template: ({ componentName, props, jsx, exports }, { tpl }) => tpl`
const ${componentName} = (${props}) => (${jsx});
${exports}
`,
typescript: true,
}),
}),
],
};
export default {
commands: [
["components", componentOptions]
],
} satisfies FigmaExportRC;