theo-clideprecated

CLI for Theo

Usage no npm install needed!

<script type="module">
  import theoCli from 'https://cdn.skypack.dev/theo-cli';
</script>

README

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-cli

Conventions

theo-cli assume that you have a token file in the root of you project named token.yml :

yourToken/
├── node_modules/
├── token.yml
└── package.json

and it will generate the following build structure:

yourToken/
├── node_modules/
├── token.yml
├── token.<format>
└── package.json

Basic usage

$ theo <[formats]> [options]

Formats

Formats are valid theo supported formats as:

  • json
  • raw.json
  • rios.json
  • android.xml
  • scss
  • map.scss
  • map.variables.scss
  • sass
  • less
  • cssmodules.css
  • aura.tokens
  • common.js

Check the Theo documentation for a full list of supported formats.

Usage example with formats:

$ theo scss cssmodules.css

Options

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.js

Use -- to pass flags:

$ lerna exec --scope ottheme-* theo scss common.js -- -o fancyFilename

Please checkout the lerna documentation for further information