0.0.6 ā€¢ Published 4 years ago

preprocessors-tokens-parser v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Design tokens are design decisions, represented as data, that ensure systematically unified and cohesive product experiences

This project born from storybook-design-token

Install

npm install --save design-tokens-parser

Usage

Parse the content of your stylesheets in search of specific comment blocks. Only those that have been indicated as @tokens will be parsed.

The block must indicate using the @tokens presenter property. The presenter refers to the example to use in your design tokens.

const { scssParser } = require('preprocessors-tokens-parser');

const fileContent = `
  /**
   * @tokens Colors
   */
  $myVar: red;
`;

const result = scssParser(fileContent);

// Output
/* [
    {
      declaration: 'myVar',
      value: 'red',
      token: 'Colors',
    },
  ];
*/

Run tests

npm run test

TODO

  • Support LESS
  • Support CSS
  • Allow to use descriptio block
  • Allow variable references as a value

Author

šŸ‘¤ Jose Cabrera joselu11cabrera@gmail.com

Show your support

Give a ā­ļø if this project helped you!

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago