Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from marcomontalbano/figmaexportrc-ts
Usage of .figmaexportrc.ts
- Loading branch information
Showing
8 changed files
with
106 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* 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/output-styles-as-sass @figma-export/transform-svg-with-svgo @figma-export/output-components-as-svg @figma-export/output-components-as-es6 | ||
*/ | ||
|
||
import { FigmaExportRC, StylesCommandOptions, ComponentsCommandOptions } from '@figma-export/types'; | ||
|
||
import outputStylesAsSass from '@figma-export/output-styles-as-sass'; | ||
import transformSvgWithSvgo from '@figma-export/transform-svg-with-svgo'; | ||
import outputComponentsAsSvg from '@figma-export/output-components-as-svg'; | ||
import outputComponentsAsEs6 from '@figma-export/output-components-as-es6'; | ||
|
||
const styleOptions: StylesCommandOptions = { | ||
fileId: 'RSzpKJcnb6uBRQ3rOfLIyUs5', | ||
outputters: [ | ||
outputStylesAsSass({ | ||
output: './output' | ||
}) | ||
] | ||
}; | ||
|
||
const componentOptions: ComponentsCommandOptions = { | ||
fileId: 'RSzpKJcnb6uBRQ3rOfLIyUs5', | ||
onlyFromPages: ['icons', 'monochrome'], | ||
transformers: [ | ||
transformSvgWithSvgo({ | ||
plugins: [ | ||
{ removeViewBox: false }, | ||
{ removeDimensions: true } | ||
] | ||
}) | ||
], | ||
outputters: [ | ||
outputComponentsAsSvg({ | ||
output: './output' | ||
}), | ||
outputComponentsAsEs6({ | ||
output: './output' | ||
}) | ||
] | ||
}; | ||
|
||
(module.exports as FigmaExportRC) = { | ||
commands: [ | ||
['styles', styleOptions], | ||
['components', componentOptions] | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { StringTransformer, ComponentOutputter } from './global'; | ||
import { StyleOutputter } from './styles'; | ||
|
||
export type BaseCommandOptions = { | ||
token: string; | ||
log?: (msg: string) => void; | ||
} | ||
|
||
export type ComponentsCommandOptions = { | ||
fileId: string; | ||
onlyFromPages?: string[]; | ||
transformers?: StringTransformer[]; | ||
outputters?: ComponentOutputter[]; | ||
} | ||
|
||
export type StylesCommandOptions = { | ||
fileId: string; | ||
outputters?: StyleOutputter[]; | ||
} | ||
|
||
export type FigmaExportRC = { | ||
commands: (['styles', StylesCommandOptions] | ['components', ComponentsCommandOptions])[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './global'; | ||
export * from './styles'; | ||
export * from './commands'; |