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: #195 #196

Merged
merged 1 commit into from
Nov 9, 2018
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
16 changes: 10 additions & 6 deletions __tests__/formats/__snapshots__/all.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports[`formats all should return android/colors as a string 1`] = `
Generated on Sat, 01 Jan 2000 00:00:00 GMT
-->
<resources>
<color name=\\"color_red\\">#FF0000</color>
<color name=\\"color_red\\">#FF0000</color><!-- comment -->

</resources>
"
Expand Down Expand Up @@ -78,7 +78,7 @@ exports[`formats all should return css/variables as a string 1`] = `
*/

:root {
--color_red: #FF0000;
--color_red: #FF0000; /* comment */
}
"
`;
Expand Down Expand Up @@ -181,7 +181,7 @@ exports[`formats all should return ios/plist as a string 1`] = `
<key>a</key>
<real>1</real>
</dict>

<!-- comment -->
</dict>
</plist>
"
Expand Down Expand Up @@ -357,7 +357,7 @@ exports[`formats all should return javascript/es6 as a string 1`] = `
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
*/

export const color_red = \\"#FF0000\\";"
export const color_red = \\"#FF0000\\"; // comment"
`;

exports[`formats all should return javascript/module as a string 1`] = `
Expand All @@ -374,6 +374,7 @@ module.exports = {
\\"value\\": \\"#FF0000\\"
},
\\"name\\": \\"color_red\\",
\\"comment\\": \\"comment\\",
\\"attributes\\": {
\\"category\\": \\"color\\",
\\"type\\": \\"red\\"
Expand Down Expand Up @@ -401,6 +402,7 @@ var _styleDictionary = {
\\"value\\": \\"#FF0000\\"
},
\\"name\\": \\"color_red\\",
\\"comment\\": \\"comment\\",
\\"attributes\\": {
\\"category\\": \\"color\\",
\\"type\\": \\"red\\"
Expand Down Expand Up @@ -439,6 +441,7 @@ exports[`formats all should return javascript/umd as a string 1`] = `
\\"value\\": \\"#FF0000\\"
},
\\"name\\": \\"color_red\\",
\\"comment\\": \\"comment\\",
\\"attributes\\": {
\\"category\\": \\"color\\",
\\"type\\": \\"red\\"
Expand All @@ -463,6 +466,7 @@ exports[`formats all should return json as a string 1`] = `
\\"value\\": \\"#FF0000\\"
},
\\"name\\": \\"color_red\\",
\\"comment\\": \\"comment\\",
\\"attributes\\": {
\\"category\\": \\"color\\",
\\"type\\": \\"red\\"
Expand Down Expand Up @@ -507,7 +511,7 @@ exports[`formats all should return less/variables as a string 1`] = `
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
*/

@color_red: #FF0000;"
@color_red: #FF0000; /* comment */"
`;

exports[`formats all should return scss/icons as a string 1`] = `
Expand All @@ -525,7 +529,7 @@ exports[`formats all should return scss/variables as a string 1`] = `
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
*/

$color_red: #FF0000;"
$color_red: #FF0000; /* comment */"
`;

exports[`formats all should return sketch/palette as a string 1`] = `
Expand Down
2 changes: 2 additions & 0 deletions __tests__/formats/all.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var dictionary = {
value: '#FF0000',
original: { value: '#FF0000' },
name: 'color_red',
comment: 'comment',
attributes: {
category: 'color',
type: 'red',
Expand All @@ -45,6 +46,7 @@ var dictionary = {
value: '#FF0000',
original: { value: '#FF0000' },
name: 'color_red',
comment: 'comment',
attributes: {
category: 'color',
type: 'red',
Expand Down
2 changes: 1 addition & 1 deletion lib/common/formats.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function variablesWithPrefix(prefix, properties) {
var to_ret_prop = prefix + prop.name + ': ' + (prop.attributes.category==='asset' ? '"'+prop.value+'"' : prop.value) + ';';

if (prop.comment)
to_ret_prop = to_ret_prop.concat(' // ' + prop.comment);
to_ret_prop = to_ret_prop.concat(' /* ' + prop.comment + ' */');
return to_ret_prop;
})
.filter(function(strVal) { return !!strVal })
Expand Down