Skip to content

Commit

Permalink
feat(config)!: use literal values in style-dictionary config (#1900)
Browse files Browse the repository at this point in the history
- remove publishing for old reference-based config output
- internally use the new output with value literals in the JSON
  • Loading branch information
booc0mtaco authored Mar 22, 2024
1 parent a3d3984 commit e470f4b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
20 changes: 1 addition & 19 deletions style-dictionary.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const EDSStyleDictionary = StyleDictionary.extend({
destination: 'lib/tokens/json/theme-base.json',
filter: function (token) {
// don't allow theming on legacy tokens
// TODO: remove filter once all legacy tokens are removed
return token.attributes.category !== 'legacy';
},
},
Expand All @@ -63,13 +64,6 @@ const EDSStyleDictionary = StyleDictionary.extend({
tailwind: {
transforms: [...StyleDictionary.transformGroup.css, 'name/cti/kebab'],
files: [
{
format: 'json/nested-css-variables',
// useful for tailwind configs in consuming apps
// NOTE: this will be replaced by the output utility config in a future version
destination: 'lib/tokens/json/css-variables-nested.json',
outputReferences: true,
},
{
format: 'json/tailwind-utility-config',
// useful for tailwind configs in consuming apps
Expand All @@ -93,18 +87,6 @@ EDSStyleDictionary.registerFormat({
},
});

EDSStyleDictionary.registerFormat({
name: 'json/nested-css-variables',
formatter: function (dictionary) {
const minifiedCssDictionary = minifyDictionaryUsingFormat(
dictionary.properties,
(obj) => `var(--${obj.name})`,
);
formatEdsTokens(minifiedCssDictionary);
return JSON.stringify(minifiedCssDictionary, null, 2);
},
});

/**
* Replace the leaf objects in the parsed style with a value object
* mimicking the input file structure. Essentially, this formatter
Expand Down
2 changes: 1 addition & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Config } from 'tailwindcss';
import { eds as edsTokens } from './lib/tokens/json/css-variables-nested.json';
import { eds as edsTokens } from './lib/tokens/json/tailwind-utility-config.json';

const {
background: backgroundColorTokens,
Expand Down

0 comments on commit e470f4b

Please sign in to comment.