spritesheetjs
Command line example
npm install spritesheetjs -g
$ spritesheetjs --help Usage: spritesheetjs [options] Options: -h, --help output usage information -V, --version output the version number -d, --source_dir [value] Image source directory -r, --rel_sprite_path [value] relative sprite path -p, --sprite_path [value] Output sprite path -c, --css_path [value] output css path
example
$ spritesheetjs -d images $ Number of images 6 $ Saved sprite.css $ Saved sprite.png
Node.js example
Install:
npm install spritesheetjs
Use:
var spritesheetjs = ; // Using a directory as a sourcevar sheet = source_dir: "path/to/images" rel_sprite_path: "" // in case your css file and sprite image are in different directories sprite_path: 'out/sprite.png' css_path: 'out/sprite.css' selector: '.sprite'; // OR an array of file paths var sheet = images: 'path/1.jpg' 'path/2.jpg' rel_sprite_path: "" // in case your css file and sprite image are in different directories sprite_path: 'out/sprite.png' css_path: 'out/sprite.css' selector: '.sprite'; sheet;