Skip to content

Commit

Permalink
fix cjsmodule formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
juliajforesti committed Apr 7, 2022
1 parent 3d161d8 commit b9a2217
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions packages/style-dictionary-legacy/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,12 @@ StyleDictionary.registerTransformGroup({
StyleDictionary.registerFormat({
name: "cjsmodule",
formatter: function ({ dictionary }) {
return `module.exports = {${dictionary.allTokens.map((token) => {
if (token.filePath.includes("colors")) {
return `\n\t${token.name.toString()}: "${token.original.value}"`;
} else {
console.log(token);
return `\n\t${token.name}: ${JSON.stringify(token.original.value)}`;
}
})}\n};`;
return `module.exports = {${dictionary.allTokens.map(
(token) =>
`\n\t${JSON.stringify(token.name)}: ${JSON.stringify(
token.original.value
)}`
)}\n};`;
},
});

Expand Down

0 comments on commit b9a2217

Please sign in to comment.