gulp-spritezero
v1.5.0
Published
Mapbox's spritezero package wrapped as a gulp plugin
Downloads
7
Maintainers
Readme
gulp-spritezero
Gulp plugin for generating spritesheets using spritezero for Mapbox.
Install
npm install gulp-spritezero
Usage
The following gulp task will generate dest/sprite.png
and dest/sprite.json
from all SVG files in the src
directory.
var gulp = require('gulp');
var spritezero = require('gulp-spritezero');
gulp.task('spritezero', function() {
return gulp.src('src/**/*.svg')
.pipe(spritezero({
scales: [ 1 ]
}))
.pipe(gulp.dest('./dest'));
});
If no options are passed to the plugin, 4 files will be generated by default:
dest/sprite.png
dest/sprite.json
dest/[email protected]
dest/[email protected]
Options
| Key | Value Type | Default | Description |
| -------- | ---------------- | ---------- |---------------------------------------- |
| scales
| Array.<Number>
| [ 1, 2 ]
| Array of scales to generate sprites for |
| name
| String
| 'sprite'
| Base name for the sprite files |
| sdf
| Boolean
| false
| Render the sprites in SDF format |
Author
Matthew Wagerfield: @wagerfield
License
Licensed under MIT. Enjoy.