-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
731 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
src | ||
tsconfig.json | ||
tsconfig.tsbuildinfo |
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,66 @@ | ||
# @figma-export/output-styles-as-style-dictionary | ||
|
||
> Styles Outputter for [@figma-export](https://github.com/marcomontalbano/figma-export) that exports styles to [Style Dictionary](https://amzn.github.io/style-dictionary/#/) JSON format. | ||
With this outputter you can export all the styles as variables inside a `.json`. | ||
|
||
This is a sample of the output: | ||
|
||
```sh | ||
$ tree output/ | ||
# output/ | ||
# └── base.json | ||
``` | ||
|
||
|
||
## .figmaexportrc.js | ||
|
||
You can easily add this outputter to your `.figmaexportrc.js`: | ||
|
||
```js | ||
module.exports = { | ||
commands: [ | ||
['styles', { | ||
fileId: 'fzYhvQpqwhZDUImRz431Qo', | ||
outputters: [ | ||
require('@figma-export/output-styles-as-style-dictionary')({ | ||
output: './output' | ||
}) | ||
] | ||
}], | ||
] | ||
} | ||
``` | ||
|
||
`output` is **mandatory**. | ||
|
||
`getExtension`, `getFilename` and `getVariableName` are **optional**. | ||
|
||
```js | ||
const { kebabCase } = require('@figma-export/utils'); | ||
|
||
... | ||
|
||
require('@figma-export/output-styles-as-style-dictionary')({ | ||
output: './output', | ||
getExtension: () => 'JSON', | ||
getFilename: () => 'base', | ||
getVariableName: (style) => kebabCase(style.name).toLowerCase(), | ||
}) | ||
``` | ||
|
||
> *defaults may change, please refer to `./src/index.ts`* | ||
## Install | ||
|
||
Using npm: | ||
|
||
```sh | ||
npm install --save-dev @figma-export/output-styles-as-style-dictionary | ||
``` | ||
|
||
or using yarn: | ||
|
||
```sh | ||
yarn add @figma-export/output-styles-as-style-dictionary --dev | ||
``` |
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,34 @@ | ||
{ | ||
"name": "@figma-export/output-styles-as-style-dictionary", | ||
"version": "4.5.0", | ||
"description": "Outputter for @figma-export that exports styles to style-dictionary tokens", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/marcomontalbano/figma-exporter.git", | ||
"directory": "packages/output-styles-as-style-dictionary" | ||
}, | ||
"author": "Marco Montalbano", | ||
"keywords": [ | ||
"figma", | ||
"export", | ||
"design", | ||
"icons", | ||
"typography", | ||
"components", | ||
"style-dictionary", | ||
"design tokens" | ||
], | ||
"license": "MIT", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@figma-export/types": "^4.5.0", | ||
"@figma-export/utils": "^4.0.0" | ||
}, | ||
"engines": { | ||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0" | ||
} | ||
} |
Oops, something went wrong.