Skip to content

Commit

Permalink
Merge 92e8ac9 into d3a253f
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomontalbano committed May 9, 2023
2 parents d3a253f + 92e8ac9 commit 256ab6e
Show file tree
Hide file tree
Showing 10 changed files with 731 additions and 6 deletions.
3 changes: 3 additions & 0 deletions packages/output-styles-as-style-dictionary/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
src
tsconfig.json
tsconfig.tsbuildinfo
66 changes: 66 additions & 0 deletions packages/output-styles-as-style-dictionary/README.md
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
```
34 changes: 34 additions & 0 deletions packages/output-styles-as-style-dictionary/package.json
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"
}
}

0 comments on commit 256ab6e

Please sign in to comment.