UNPKG

1.53 kBMarkdownView Raw
1# [gulp](https://github.com/gulpjs/gulp)-svgmin [![Build Status](https://travis-ci.org/ben-eb/gulp-svgmin.svg?branch=master)](https://travis-ci.org/ben-eb/gulp-svgmin) [![NPM version](https://badge.fury.io/js/gulp-svgmin.svg)](http://badge.fury.io/js/gulp-svgmin) [![Dependency Status](https://gemnasium.com/ben-eb/gulp-svgmin.png)](https://gemnasium.com/ben-eb/gulp-svgmin)
2
3> Minify SVG with [SVGO](https://github.com/svg/svgo).
4
5*If you have any difficulties with the output of this plugin, please use the [SVGO tracker](https://github.com/svg/svgo/issues).*
6
7Install via [npm](https://npmjs.org/package/gulp-svgmin):
8
9```
10npm install gulp-svgmin --save-dev
11```
12
13## Example
14
15```js
16var gulp = require('gulp');
17var svgmin = require('gulp-svgmin');
18
19gulp.task('default', function() {
20 return gulp.src('logo.svg')
21 .pipe(svgmin())
22 .pipe(gulp.dest('./out'));
23});
24```
25
26## Plugins
27
28Optionally, you can disable any [SVGO plugins](https://github.com/svg/svgo/tree/master/plugins) to customise the output. You will need to provide the config in comma separated objects, like the example below.
29
30```js
31gulp.task('default', function() {
32 return gulp.src('logo.svg')
33 .pipe(svgmin({
34 plugins: [{
35 removeDoctype: false
36 }, {
37 removeComments: false
38 }]
39 }))
40 .pipe(gulp.dest('./out'));
41});
42```
43
44## Contributing
45
46Pull requests are welcome. If you add functionality, then please add unit tests to cover it.
47
48## License
49
50MIT © Ben Briggs