twolfson / grunt-spritesmith

Grunt task for converting a set of images into a spritesheet and corresponding CSS variables
MIT License
1.14k stars 92 forks source link

Generated sprite variables have trailing comma #161

Closed tpgmartin closed 8 years ago

tpgmartin commented 8 years ago

Hey there,

Minor issue, but the individual image variables lists in the generated stylesheet - in my case SCSS - always have trailing commas before the closing bracket.

For instance,

$img: (0px, 0px, 0px, 0px, 87px, 14px, 122px, 108px, '/sprite.png', 'img', );

Cheers

twolfson commented 8 years ago

This is expected behavior, the reason is we have lists of unknown length at other points (e.g. $sprites) and since we are using Handlebars, we cannot detect when we are at the last element in an each. As a result, we have a trailing comma in those locations.

https://github.com/twolfson/spritesheet-templates/blob/10.1.2/lib/templates/scss.template.handlebars#L41

https://github.com/twolfson/spritesheet-templates/blob/10.1.2/test/expected_files/scss.scss#L50

The trailing comma in the posted example is to keep the file consistent with its trailing commas.

tpgmartin commented 8 years ago

Thanks for your response, that's good to know

davegomez commented 7 years ago

So there's no way to dealing with this?

I can't use Spritesmith with older versions of SASS (the one we have in our prod server).

twolfson commented 7 years ago

This can be worked around via:

I wasn't aware there was a version of SASS that didn't support this. What's the SASS version?