Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct CSS variable names with no sets present #27

Merged
merged 2 commits into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ dist

# TernJS port file
.tern-port

# Test output
tests/__output
3 changes: 3 additions & 0 deletions lib/css-sets-formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ const formatter = ({ dictionary, platform, file, options }) => {
})
);
}
else {
name = name.concat(token.path);
}
resultAr.push(
` --${name.join("-")}: ${valueFormatter(token, platform, dictionary)};`
);
Expand Down
1 change: 1 addition & 0 deletions tests/css-formatter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ test("tokens without sets should still have names", () => {
config.platforms.CSS.files[0].filter = (token) => {
return !("sets" in token.attributes);
};
delete config.platforms.CSS.files[0].options.sets;
const sd = StyleDictionary.extend(config);
sd.buildAllPlatforms();
const result = fs.readFileSync(
Expand Down
6 changes: 3 additions & 3 deletions tests/expected/multi-ref.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:root {
--background-color: var(--color-gray-100);
--light-gray: #EEEEEE;
--dark-gray: #111111;
--component-background-color: var(--color-gray-100);
--static-colors-light-gray: #EEEEEE;
--static-colors-dark-gray: #111111;
}