@quartzds/design-token-generator v4.0.0
Quartz Design Token Generator
š” Overview
This tool translates Quartz's design tokens JSON file into resources for developers. The tokens JSON file is edited using the Tokens Studio plugin, then transformed using the Style Dictionary library.
Prerequisites
- A JSON file produced by the Tokens Studio plugin
- node
"^14.17.0 || >=16.0.0"
- npm
>=6
Token transformation rules
Translating design tokens into platform-specific assets requires rules. Quartz uses specific rules based on its own design tokens conventions. The goal of this library is to package all those transformation rules into a convenient API.
Customizing quartz styles
This tool allows you to customize Quartz with your brand and styles. This will be described on our website soon.
TODO: link to the documentation page.
šæ Installation
npm install @quartzds/design-token-generator
š Usage
qds-token-generator generate
By default, this command reads the design-tokens.json
file in the current working directory and translates it into assets for all the supported platforms:
<cwd>
āāā dist
ā āāā platform
ā | āāā desktop.css
ā | āāā mobile.css
ā āāā theme
ā āāā dark.css
ā āāā light.css
āāā build
āāā android
ā āāā platform
ā | āāā desktop.xml
ā | āāā mobile.xml
ā āāā theme
ā āāā dark.xml
ā āāā light.xml
āāā ios
āāā platform
| āāā desktop.swift
| āāā mobile.swift
āāā theme
āāā dark.swift
āāā light.swift
Select the platforms to generate
To generate specific platforms, use the --platform
option to provide the list of platforms, separated by semicolons:
qds-token-generator generate --platform 'css'
See the list of supported platforms for more info.
Configure output paths
Each platform also provides a option to specify where the files will be output:
qds-token-generator generate \
--platform 'css' \
--css-output 'resources/css'
The example above generates the following files:
<cwd>
āāā resources
āāā css
āāā platform
| āāā desktop.css
| āāā mobile.css
āāā theme
āāā dark.css
āāā light.css
š» API reference
Name | Shortcut | Default Value | Description |
---|---|---|---|
--input | -i | ./design-tokens.json | Relative location of the token file from Figma |
--platform | -p | all | Semicolon-separated list of platforms to generate: ios , android , css , all |
--css-output | ./dist | Output directory relative location for CSS | |
--android-output | ./build/android | Output directory relative location for Android | |
--ios-output | ./build/ios | Output directory relative location for iOS | |
--copyright | Copyright <year> Schneider Electric | Copyright header to be placed in generated files | |
--copyright-year | current year | Specify the year in the default copyright header |
Supported platforms
Values to use with the --platform
option:
Value | Description |
---|---|
all (default) | All supported platforms |
css | Standard CSS files |
ios | Swift classes with constants for iOS |
android | XML resources files for Android |
āļø License
See the LICENSE file for license rights and limitations.
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago