Adds a CLI to the spritesmith module
Spritesmith is awesome but sometimes we don't want to run it through Grunt.
npm install -D spritesmith-cli
spritesmith [options]
These are the options you can set on the CLI.
Option | Description |
---|---|
--rc |
Point to a different .spritesmith.js configuration file |
The default configuration file used will be .spritesmith.js
at the current working directory (process.cwd()
). This file should export a few properties. Note that you can export either a single object or an array. If you use an array you'll be able to create multiple spritesheets in one shot.
Examples:
'use strict';
var util = require('util');
module.exports = {
src: './client/img/icons/**/*.{png,gif,jpg}',
destImage: '.bin/public/img/icons.png',
destCSS: 'client/css/generated/icons.css',
imgPath: '/img/icons.png',
cssOpts: {
cssClass: function (item) {
return util.format('.ic-%s:before', item.name);
}
}
};
'use strict';
var util = require('util');
module.exports = [{
src: './client/img/icons/**/*.{png,gif,jpg}',
destImage: '.bin/public/img/icons.png',
destCSS: 'client/css/generated/icons.css',
imgPath: '/img/icons.png',
cssOpts: {
cssClass: function (item) {
return util.format('.ic-%s:before', item.name);
}
}
}, {
src: './client/img/markdown-editor/**/*.{png,gif,jpg}',
destImage: '.bin/public/img/markdown-editor.png',
destCSS: 'client/css/generated/markdown-editor.styl',
imgPath: '/img/markdown-editor.png',
cssOpts: {
cssClass: function (item) {
return util.format('.pm-%s:before', item.name);
}
}
}];
Note that src
can be either a globbing pattern or an array of globbing patterns, it'll be passed straight to multi-glob
.
That's about it. For configuration information please refer to the grunt-spritesmith
and spritesmith
packages.
MIT