4.0.0 ā€¢ Published 11 months ago

@quartzds/design-token-generator v4.0.0

Weekly downloads
-
License
LGPL-2.1-only
Repository
github
Last release
11 months ago

Quartz Design Token Generator

CI Status NPM Package License REUSE status

šŸ’” 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

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

NameShortcutDefault ValueDescription
--input-i./design-tokens.jsonRelative location of the token file from Figma
--platform-pallSemicolon-separated list of platforms to generate: ios, android, css, all
--css-output./distOutput directory relative location for CSS
--android-output./build/androidOutput directory relative location for Android
--ios-output./build/iosOutput directory relative location for iOS
--copyrightCopyright <year> Schneider ElectricCopyright header to be placed in generated files
--copyright-yearcurrent yearSpecify the year in the default copyright header

Supported platforms

Values to use with the --platform option:

ValueDescription
all (default)All supported platforms
cssStandard CSS files
iosSwift classes with constants for iOS
androidXML resources files for Android

āš–ļø License

See the LICENSE file for license rights and limitations.

4.0.0

11 months ago

4.0.0-beta.1

1 year ago

3.1.0-beta.1

1 year ago

3.0.1

1 year ago

3.0.0-beta.5

1 year ago

3.0.0

1 year ago

3.0.0-beta.4

1 year ago

2.0.1-0

1 year ago

3.0.0-beta.3

1 year ago

3.0.0-beta.1

1 year ago

2.0.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago