-
-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy path.figmaexportrc.example.local.js
More file actions
101 lines (95 loc) · 3.06 KB
/
Copy path.figmaexportrc.example.local.js
File metadata and controls
101 lines (95 loc) · 3.06 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
98
99
100
101
// @ts-check
/**
* If you want to try this configuration you can just run:
* $ yarn
* $ yarn build
* $ node ./packages/cli/bin/run.js use-config .figmaexportrc.example.local.js
*/
import path from 'node:path';
import outputComponentsAsEs6 from './packages/output-components-as-es6/dist/index.js';
import outputComponentsAsSvg from './packages/output-components-as-svg/dist/index.js';
import outputComponentsAsSvgr from './packages/output-components-as-svgr/dist/index.js';
import outputComponentsAsSvgstore from './packages/output-components-as-svgstore/dist/index.js';
import outputStylesAsCss from './packages/output-styles-as-css/dist/index.js';
import outputStylesAsLess from './packages/output-styles-as-less/dist/index.js';
import outputStylesAsSass from './packages/output-styles-as-sass/dist/index.js';
import outputStylesAsStyleDictionary from './packages/output-styles-as-style-dictionary/dist/index.js';
import transformSvgWithSvgo from './packages/transform-svg-with-svgo/dist/index.js';
/** @type {import('./packages/types').StylesCommandOptions} */
const styleOptions = {
fileId: 'fzYhvQpqwhZDUImRz431Qo',
// onlyFromPages: ['icons'], // optional - Figma page names or IDs (all pages when not specified)
outputters: [
outputStylesAsCss({
output: './output/styles/css',
}),
outputStylesAsLess({
output: './output/styles/less',
}),
outputStylesAsSass({
output: './output/styles/sass',
}),
outputStylesAsStyleDictionary({
output: './output/styles/style-dictionary',
}),
],
};
/** @type {import('./packages/types').ComponentsCommandOptions} */
const componentOptions = {
fileId: 'fzYhvQpqwhZDUImRz431Qo',
onlyFromPages: ['icons'],
concurrency: 1,
transformers: [
transformSvgWithSvgo({
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false,
},
},
},
{
name: 'removeDimensions',
},
],
}),
],
outputters: [
outputComponentsAsEs6({
output: './output/components/es6',
useBase64: true,
}),
outputComponentsAsSvg({
output: './output/components/svg',
getDirname: (options) => {
const pathToComponent = options.pathToComponent
.map((p) => p.name)
.join(path.sep);
return `${options.pageName}${path.sep}${options.dirname}${path.sep}${pathToComponent}`;
},
}),
outputComponentsAsSvgr({
output: './output/components/svgr',
getSvgrConfig: () => ({
plugins: ['@svgr/plugin-jsx'],
template: ({ componentName, props, jsx, exports }, { tpl }) => tpl`
const ${componentName} = (${props}) => (${jsx});
${exports}
`,
}),
}),
outputComponentsAsSvgstore({
output: './output/components/svgstore',
svgstoreConfig: {},
}),
],
};
/** @type {import('./packages/types').FigmaExportRC} */
export default {
commands: [
['styles', styleOptions],
['components', componentOptions],
],
};