gulp-svgmin
Version:
Minify SVG files with gulp.
41 lines (30 loc) • 1.33 kB
Markdown
> Minify SVG with [SVGO](https://github.com/svg/svgo).
*If you have any difficulties with the output of this plugin, please use the [SVGO tracker](https://github.com/svg/svgo/issues).*
Install via [npm](https://npmjs.org/package/gulp-svgmin):
```
npm install gulp-svgmin --save-dev
```
```
var gulp = require('gulp');
var svgmin = require('gulp-svgmin');
gulp.task('default', function() {
gulp.src('logo.svg')
.pipe(svgmin())
.pipe(gulp.dest('./out'));
});
```
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.
```
gulp.task('default', function() {
gulp.src('logo.svg')
.pipe(svgmin([{
removeDoctype: false
}, {
removeComments: false
}]))
.pipe(gulp.dest('./out'));
});
```