Skip to content

Instantly share code, notes, and snippets.

@markthethomas
Created June 27, 2014 17:48
Show Gist options
  • Save markthethomas/4f51bfe3e6444c1d9c15 to your computer and use it in GitHub Desktop.
Save markthethomas/4f51bfe3e6444c1d9c15 to your computer and use it in GitHub Desktop.
Quick grunt-spritesmith config
//..........
sprite: {
all: {
src: 'app/images/FILE_PATH_HERE/*.png',
destImg: 'app/images/spritesheet.png',
destCSS: 'app/styles/_sprites.scss',
'padding': 5,
'cssFormat': 'css',
// OPTIONAL: Map variable of each sprite
'cssVarMap': function(sprite) {
// `sprite` has `name`, `image` (full path), `x`, `y`
// `width`, `height`, `total_width`, `total_height`
// EXAMPLE: Prefix all sprite names with 'sprite-'
sprite.name = 'sprite-' + sprite.name;
},
}
}
//..........
grunt.loadNpmTasks('grunt-spritesmith');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment