Skip to content

Commit

Permalink
fix: rename open type from formatter to transform
Browse files Browse the repository at this point in the history
  • Loading branch information
castastrophe authored and GarthDB committed Mar 31, 2023
1 parent 8bb3a5b commit 96e946a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,7 @@ will add transform the tokens to have the `sets` attribute like this:
}
```

### `json/sets` formatter

Some of this functionality is still being updated and refined for specific uses.

### `css/sets` formatter

WIP

### `font/openType` formatter
### `font/openType` transform

This utility converts font-weight values from standard [Open Type syntax](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight#common_weight_name_mapping) into a CSS-safe format.

Expand All @@ -203,18 +195,26 @@ In the `config.js` bring in the transform, register it to Style Dictionary and a

```js
const StyleDictionary = require("style-dictionary");
const CSSOpenTypeFormatter = require("style-dictionary-sets").CSSOpenTypeFormatter;
const CSSOpenTypeTransform = require("style-dictionary-sets").CSSOpenTypeTransform;

StyleDictionary.registerTransform(CSSOpenTypeFormatter);
StyleDictionary.registerTransform(CSSOpenTypeTransform);

module.exports = {
source: ["tokens/**/*.json"],
platforms: {
JSON: {
buildPath: "dist/json/",
transforms: [CSSOpenTypeFormatter.name],
transforms: [CSSOpenTypeTransform.name],
files: ...
},
},
};
```

### `json/sets` formatter

Some of this functionality is still being updated and refined for specific uses.

### `css/sets` formatter

WIP
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ const JsonSetsFormatter = require("./lib/json-sets-formatter");
const AttributeSetsTransform = require("./lib/attribute-sets-transform");
const NameKebabTransfom = require("./lib/name-kebab-transform");
const CSSSetsFormatter = require("./lib/css-sets-formatter.js");
const CSSOpenTypeFormatter = require("./lib/css-font-open-type-formatter.js");
const CSSOpenTypeTransform = require("./lib/css-font-open-type-transform.js");
const DroverJsonFormatter = require("./lib/drover-json-formatter.js");

module.exports = {
JsonSetsFormatter,
AttributeSetsTransform,
NameKebabTransfom,
CSSSetsFormatter,
CSSOpenTypeFormatter,
CSSOpenTypeTransform,
DroverJsonFormatter,
};
File renamed without changes.
6 changes: 3 additions & 3 deletions tests/css-formatter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ const StyleDictionary = require("style-dictionary");
const CSSSetsFormatter = require("../index").CSSSetsFormatter;
const NameKebabTransfom = require("../index").NameKebabTransfom;
const AttributeSetsTransform = require("../index").AttributeSetsTransform;
const CSSOpenTypeFormatter = require("../index").CSSOpenTypeFormatter;
const CSSOpenTypeTransform = require("../index").CSSOpenTypeTransform;
const helpers = require("./helpers");

const fs = require("fs");
const path = require("path");

StyleDictionary.registerTransform(NameKebabTransfom);
StyleDictionary.registerTransform(AttributeSetsTransform);
StyleDictionary.registerTransform(CSSOpenTypeFormatter);
StyleDictionary.registerTransform(CSSOpenTypeTransform);
StyleDictionary.registerFormat(CSSSetsFormatter);

const generateConfig = (filename) => {
Expand All @@ -19,7 +19,7 @@ const generateConfig = (filename) => {
platforms: {
CSS: {
buildPath: helpers.outputDir,
transforms: [AttributeSetsTransform.name, NameKebabTransfom.name, CSSOpenTypeFormatter.name],
transforms: [AttributeSetsTransform.name, NameKebabTransfom.name, CSSOpenTypeTransform.name],
files: [
{
destination: `${filename}.css`,
Expand Down

0 comments on commit 96e946a

Please sign in to comment.