Skip to content

Instantly share code, notes, and snippets.

@dbanksdesign
Created September 27, 2019 15:59
Show Gist options
  • Select an option

  • Save dbanksdesign/0bf80d7837e2454a4f89c04ad735de97 to your computer and use it in GitHub Desktop.

Select an option

Save dbanksdesign/0bf80d7837e2454a4f89c04ad735de97 to your computer and use it in GitHub Desktop.
Style Dictionary Filter Example
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