davidtheclark / grunt-spritesmith-hd

An adaptation of grunt-spritesmith to produce hd-ready sprites
Other
10 stars 5 forks source link

allow scss_maps format #9

Closed benib closed 10 years ago

benib commented 10 years ago

This needs https://github.com/twolfson/json2css/pull/27 to be merged to get usable. I send this PR in to get opinions on this.

Basically this allows to set cssFormat and cssOpts and passes them to grunt-spritesmith. cssFormat is used to choose the template for the ld sprite. So the only allowed values for cssFormat are scss (default to not break bc) and scss_maps which then leads to the usage of the scss_maps template of json2css. cssOpts.mapName gets overwritten/defined with the spriteName to have different mapNames per sprite. The new scss_maps-hd.template.mustache is based on the one from json2css that is changed in the metioned PR to json2css to allow for a configured sass-map name.

A new configuration for spritesmith-hd config could then look like this f.e.:

spriteHD: {
    options: {
        destImg: 'images/',
        destCSS: 'sass/sprites',
        cssFormat: 'scss_maps',
    },
    spriteOne: {
        src: ['sprites/spriteTwo/*.png'],
        spriteName: 'spriteOne',
    },
    spriteTwo: {
        src: ['sprites/spriteTwo/*.png'],
        spriteName: 'spriteTwo',
    }
},
benib commented 10 years ago

Since the PR to json2css will not get merged, this is obsolete.

davidtheclark commented 10 years ago

Well, thanks for the offer.