Skip to content

Commit

Permalink
fix(format): adding configurable name to sass map name (#291)
Browse files Browse the repository at this point in the history
Fix #290
  • Loading branch information
dbanksdesign authored and chazzmoney committed Jun 18, 2019
1 parent 651ced2 commit cfa2422
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
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

0 comments on commit cfa2422

Please sign in to comment.