@lmcd/gulp-svgo
v0.1.1
Published
A SVGO-wrapper for Gulp.
Downloads
63
Maintainers
Readme
@lmcd/gulp-svgo
gulp-svgo is a SVGO-wrapper for Gulp. Compatible with all modern versions of SVGO.
Installation
To use gulp-svgo, you must install both gulp-svgo and the svgo package.
npm install --save-dev svgo @lmcd/gulp-svgo
Usage
const { src, dest } = require('gulp');
const gulpSvgo = require('@lmcd/gulp-svgo');
const svgo = require('svgo');
function minify() {
return src('./svg/*.svg')
.pipe(gulpSvgo(svgo))
.pipe(dest('./svg'));
};
gulp-svgo exports factory method with the following signature:
(svgo: svgo, options?: Record<string, any>)
Where:
svgo
must be the svgo package.options
can be any key-value pairs, but as these are passed directly to SVGO'soptimize
function, these should correspond with SVGO's configuration options.
Implementation notes
- By default, this plugin will disable the
removeViewBox
SVGO plugin. - This plugin does not fail if
svgo
encounters a syntax error in the input SVG files and will instead output the file unchanged. - This plugin does not support Gulp versions earlier than Gulp 4.
- This plugin does not automatically load
svgo.config.js
. - Passing a character-encodings other than UTF-8 is not explicitly disallowed, but the results are indeterminate.
License
This repository is licensed under the MIT license.