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

Compatibility with grunt-newer? #60

Closed sebastienbarre closed 10 years ago

sebastienbarre commented 10 years ago

Great plugin. Is there any plan to make it compatible with the equally useful "grunt-newer" plugin? All other plugins I'm using seem to work out of the box but spritesmith won't, unfortunately:

Running "newer:sprite:employees1x" (newer) task
[...]
Running "sprite:employees1x" (sprite) task
Verifying property sprite.employees1x exists in config...OK
Files: build/tmp/images/employees@1X/dan.lipsa.jpg -> [no dest]
Fatal error: grunt.sprite requires a src, destImg, and destCSS property

I suspect that's because it doesn't follow the usual way source and target files are specified:

sprite: {
  employees1x: {
    src: 'build/tmp/images/employees@1X/*.jpg',
    destImg: 'build/images/employees/employees@1X.jpg',
    destCSS: 'build/css/employees@1X.css'
  }
}

Whereas this syntax below could probably help? Not certain, just a hunch, I might not have identified the problem correctly.

sprite: {
  employees1x: {
    options: {
      destImg: 'build/images/employees/employees@1X.jpg',
      destCSS: 'build/css/employees@1X.css'
    },
    files: [{
      expand: true,
      cwd: 'build/tmp/images/employees@1X/',
      src: ['*.jpg']
    }]
  }
}

Thank you. (I also submitted this issue in the grunt-newer tracker, for suggestions)

sebastienbarre commented 10 years ago

Update: seems "grunt-spritely" does just that.

twolfson commented 10 years ago

Thanks for reaching out! There is a related issue, #55, which seems to be one and the same as grunt-spritely.

To re-iterate why I decided to close the issue, I have chosen to maintain support for grunt@0.3 for a while. If I were to move to the suggested format, then I would have to lose backwards compatibility.

I don't have any insight into the grunt@0.3 vs grunt@0.4 download count (read as "market share") but I am going to jump into #npm to find out if that is possible to scrape.

I will probably drop support 1 year from grunt@0.4's release (February 18) but no promises.

Thanks again for opening the issue =)

twolfson commented 10 years ago

I did some research but it looks like I cannot gather the distribution between grunt@0.3 and grunt@0.4 for now. I have opened an issue about it

https://github.com/isaacs/npm-www/issues/516

twolfson commented 9 years ago

We have moved to the dest signature for destImg in 3.0.0. This should add grunt-newer support.

twolfson commented 9 years ago

I thought grunt-newer was working but never mind. It seems to not be reinvoking properly. I will try to revisit this after I handle the gulp.spritesmith release.

twolfson commented 9 years ago

I decided to fix it sooner rather than later. grunt-newer is supported as of 3.1.0.