Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wagerfield/gulp-spritezero

Gulp plugin for spritezero
https://github.com/wagerfield/gulp-spritezero

Last synced: 6 days ago
JSON representation

Gulp plugin for spritezero

Awesome Lists containing this project

README

        

# gulp-spritezero

[Gulp][gulp] plugin for generating spritesheets using [spritezero][spritezero] for [Mapbox][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.` | `[ 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][sdf] format |

## Author

Matthew Wagerfield: [@wagerfield][twitter]

## License

Licensed under [MIT][mit]. Enjoy.

[twitter]: http://twitter.com/wagerfield
[mit]: http://www.opensource.org/licenses/mit-license.php
[gulp]: http://gulpjs.com/
[spritezero]: https://github.com/mapbox/spritezero
[mapbox]: https://www.mapbox.com/
[sdf]: https://www.mapbox.com/blog/text-signed-distance-fields/