Skip to content

cloudflightio/style-dictionary-transformer

Repository files navigation

Cloudflight Style Dictionary

License master @cloudflight/style-dictionary-transformer

Amazon style dictionary configured with Cloudflight best practices in mind.

Installation

The following dependencies are required:

"style-dictionary": "*"

Usage

Create a javascript file with the following content:

import {cloudflightPlatformConfigWith, registerItems} from '@cloudflight/style-dictionary-transformer';
import StyleDictionary from 'style-dictionary';

registerItems(StyleDictionary);

const StyleDictionaryExtended = StyleDictionary.extend({
    source: ['assets/design-tokens/*.json'],
    platforms: {
        ...cloudflightPlatformConfigWith({
            web: {
                declaration: {
                    outputDirectory: '<your-output-directory>',
                },
            },
        }),
    },
});

StyleDictionaryExtended.buildAllPlatforms();

Execute this script as part of your build. It will generate styles into you output directory for further use.

Contributing