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 |
|
7 | Install via [npm](https://npmjs.org/package/gulp-svgmin):
|
8 |
|
9 | ```
|
10 | npm install gulp-svgmin --save-dev
|
11 | ```
|
12 |
|
13 | ## Example
|
14 |
|
15 | ```js
|
16 | var gulp = require('gulp');
|
17 | var svgmin = require('gulp-svgmin');
|
18 |
|
19 | gulp.task('default', function() {
|
20 | return gulp.src('logo.svg')
|
21 | .pipe(svgmin())
|
22 | .pipe(gulp.dest('./out'));
|
23 | });
|
24 | ```
|
25 |
|
26 | ## Plugins
|
27 |
|
28 | Optionally, 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
|
31 | gulp.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 |
|
46 | Pull requests are welcome. If you add functionality, then please add unit tests to cover it.
|
47 |
|
48 | ## License
|
49 |
|
50 | MIT © Ben Briggs
|