amzn/style-dictionary

View on GitHub
docs/using_the_cli.md

Summary

Maintainability
Test Coverage
# Using the CLI

The Style Dictionary command line interface (CLI) provides an executable system to create and act upon style dictionaries.


# Installation
To use the CLI, you can install it globally via npm:
```bash
$ npm install -g style-dictionary
```


# CLI Quick Start
This will create a new folder called 'quick-start' and populate it with a Style Dictionary configuration and properties.
```bash
$ mkdir quick-start && cd quick-start
$ style-dictionary init basic
```
You can then modify the properties in the properties directory and run the build command below. See the changes in the output generated in the build folder.
```bash
$ style-dictionary build
```


# Commands
The CLI provides three basic commands:
* [build](using_the_cli.md?id=build)  Builds a style dictionary package from the current directory.
* [clean](using_the_cli.md?id=clean)  Removes files specified in the config of the style dictionary package of the current directory.
* [init](using_the_cli.md?id=init)      Generates a starter style dictionary

These commands can be run using:
```bash
$ style-dictionary [command] [options]
```


# build
Builds a style dictionary package from the current directory. Usage:
```bash
$ style-dictionary build [options]
```
Options:
| Name | Usage | Description |
| :--- | :--- | :--- |
| Configuration Path | -c <path>, --config <path> | Set the path to the configuration file. Defaults to './config.json'. |
| Platform | -p <platform>, --platform <platform> | Only build a specific platform. If not supplied, builds all platform found in the configuration file. |


# clean
Removes files and folders generated by a previously run 'build' command. Usage:
```bash
$ style-dictionary clean [options]
```
Options:
| Name | Usage | Description |
| :--- | :--- | :--- |
| Configuration Path | -c <path>, --config <path> | Set the path to the configuration file. Defaults to './config.json'. |
| Platform | -p <platform>, --platform <platform> | Only clean a specific platform. If not supplied, cleans all platform found in the configuration file. |


# init
Generates a starter style dictionary, based on the supplied example type. Usage:
```bash
$ style-dictionary init <example-type>
```
Where example-type is one of:
* `basic`
* `complete`

<!-- A full list of example-types can be found [here](https://github.com/amzn/style-dictionary/tree/master/examples/). -->


# Version
To see what version of Style Dictionary you have, run this command:
```bash
$ style-dictionary --version
```