UNPKG

1.34 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 removeDoctype: false
35 }, {
36 removeComments: false
37 }]))
38 .pipe(gulp.dest('./out'));
39});
40```