Skip to content

Commit

Permalink
make repo publish ready (#7)
Browse files Browse the repository at this point in the history
Signed-off-by: Kangrui Ye <[email protected]>
  • Loading branch information
strawberry-choco authored Mar 8, 2023
1 parent 854a0f5 commit ba74dca
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 3 deletions.
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Cloudflight Style Dictionary

[![License](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://opensource.org/licenses/Apache-2.0)
![master](https://github.com/cloudflightio/cloudflight-style-dictionary-transformer/actions/workflows/build.yml/badge.svg?branch=master)
[![@cloudflight/style-dictionary-transformer](https://img.shields.io/npm/v/@cloudflight/style-dictionary-transformer?label=@cloudflight/style-dictionary-transformer)](https://www.npmjs.com/package/@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:

```javascript
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({
styleDeclarationOutputDirectory: '<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

- [Contributing to the project](CONTRIBUTING.md)
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
"main": "./dist/index.js",
"author": "Cloudflight GmbH",
"license": "Apache-2.0",
"keywords": [
"style-dictionary",
"transform"
],
"homepage": "https://github.com/cloudflightio/style-dictionary-transformer",
"bugs": {
"url": "https://github.com/cloudflightio/style-dictionary-transformer/issues"
},
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion src/transform-groups/custom-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const customPropertiesTransformGroup: Named<TransformGroup> = {
'name/cti/kebab',
'time/seconds',
'content/icon',
'color/hsl-4',
'color/hex',
pxTransform.name,
percentTransform.name,
fontStyleTransform.name,
Expand Down
4 changes: 2 additions & 2 deletions test-data/color-transform/expected/variables_impl.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:root {
--color-my-super-fancy-red: hsl(0 100% 50%);
--color-my-super-fancy-green: hsl(118 44% 33%);
--color-my-super-fancy-red: #ff0000;
--color-my-super-fancy-green: #327a30;
}

0 comments on commit ba74dca

Please sign in to comment.