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(format): adding configurable name to sass map name #291

Merged
merged 2 commits into from
Jun 18, 2019
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
6 changes: 5 additions & 1 deletion lib/common/formats.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ module.exports = {
/**
* Creates a SCSS file with a flat map based on the style dictionary
*
* Name the map by adding a 'mapName' attribute on the file object in your config.
*
* @memberof Formats
* @kind member
* @example
Expand All @@ -123,7 +125,9 @@ module.exports = {
},

/**
* Creates a SCSS file with a deep map based on the style dictionary
* Creates a SCSS file with a deep map based on the style dictionary.
*
* Name the map by adding a 'mapName' attribute on the file object in your config.
*
* @memberof Formats
* @kind member
Expand Down
2 changes: 1 addition & 1 deletion lib/common/templates/scss/map-deep.template
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
// output the list of tokens as a Sass nested map
// (the values are pointing to the variables)
//
print(`$tokens: ${processJsonNode(properties, 0)};\n`);
print(`$${this.mapName||'tokens'}: ${processJsonNode(properties, 0)};\n`);

// recursive function to process a properties JSON node
//
Expand Down
2 changes: 1 addition & 1 deletion lib/common/templates/scss/map-flat.template
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
print('\n');

var output = '';
output += '$tokens: (\n';
output += `$${this.mapName||'tokens'}: (\n`;
output += allProperties.map(function(prop){
var line = '';
if(prop.comment) {
Expand Down