theo-cli v0.0.6
Theo-cli
CLI for theo
About this tool
This is a CLI that allows you to use
theo to buld one or multiple tokens. theo-cli forwards on the formats
and other relevant options to theo in order to build the token in the desired formats.
Installation
This module is distributed via npm and should
be added as one of your project's devDependencies:
$ npm install --save-dev theo-cliConventions
theo-cli assume that you have a token file in the root of you project named token.yml :
yourToken/
├── node_modules/
├── token.yml
└── package.jsonand it will generate the following build structure:
yourToken/
├── node_modules/
├── token.yml
├── token.<format>
└── package.jsonBasic usage
$ theo <[formats]> [options]Formats
Formats are valid theo supported formats as:
jsonraw.jsonrios.jsonandroid.xmlscssmap.scssmap.variables.scsssasslesscssmodules.cssaura.tokenscommon.js
Check the Theo documentation for a full list of supported formats.
Usage example with formats:
$ theo scss cssmodules.cssOptions
| Name | Description | Default |
|---|---|---|
--path | -p | The absolute path where source token is located | process.cwd |
--dist | -d | The relative path where to generate the build | . |
--output | -o | The output filename | token.<format> |
--src | -s | The src file | token.yml |
--test | -t | Disable writing to files for the token (test build scenario) | false |
NPM Scripts
Typically you'll use this in your npm scripts:
{
"scripts": {
"build": "theo scss cssmodules.css"
}
}the following result will be printed on your terminal:
✏️ scss tokens created at "yourToken/token.scss"
✏️ cssmodules.css tokens created at "yourToken/token.cssmodules.css"MonoRepo with Lerna
theo-cli can be used together with lerna to build specific tokens for specific pakacges in your monorepo, using the exec command of lerna:
$ lerna exec --scope ottheme-* theo scss common.jsUse -- to pass flags:
$ lerna exec --scope ottheme-* theo scss common.js -- -o fancyFilenamePlease checkout the lerna documentation for further information