Created
September 27, 2019 15:59
-
-
Save dbanksdesign/0bf80d7837e2454a4f89c04ad735de97 to your computer and use it in GitHub Desktop.
Style Dictionary Filter Example
This file contains hidden or 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
| const StyleDictionary = require('style-dictionary'); | |
| StyleDictionary.registerFilter({ | |
| name: 'test', | |
| matcher: (prop) => { | |
| return prop.attributes.category === 'color'; | |
| } | |
| }); | |
| StyleDictionary.extend({ | |
| properties: { | |
| color: { | |
| white: { value: "#fff" } | |
| }, | |
| size: { | |
| large: { value: 10 } | |
| } | |
| }, | |
| platforms: { | |
| test: { | |
| transforms: ['attribute/cti'], | |
| files: [{ | |
| destination: 'dist/variables.css', | |
| filter: 'test', | |
| format: 'css/variables' | |
| }] | |
| } | |
| } | |
| }).buildAllPlatforms(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment