Export TexturePacker compatible sprite sheets with SpriteSmith using JSON array format
npm install spritesmith-texturepacker-arrayTexturePacker export template for SpriteSmith - using the array format preferred by Phaser.io
This very tiny module makes exporting TexturePacker compatible JSON sprite sheets
with grunt-spritesmith or
gulp.spritesmith. Just pass
it along via the cssTemplate parameter.
Building a TexturePacker sprite sheet with gulp.
``js
var spritesmith = require('gulp.spritesmith');
gulp.task('sprite', function () {
return gulp.src('src/gfx/scubaman/*.png')
.pipe(spritesmith({
imgName: "scubaman.png",
cssName: "scubaman.json",
algorithm: 'binary-tree',
cssTemplate: require('spritesmith-texturepacker-array') // <-- this right here
})
.pipe(gulp.dest('./dist/gfx/'));
});
`
With npm:
```
npm install spritesmith-texturepacker-array
[npm-url]: https://www.npmjs.org/package/spritesmith-texturepacker-array
[npm-image]: http://img.shields.io/npm/v/spritesmith-texturepacker-array.svg?style=flat
[npm-download-image]: http://img.shields.io/npm/dm/spritesmith-texturepacker-array.svg?style=flat