@lmcd/gulp-svgo
v0.2.0
Published
A SVGO-wrapper for Gulp.
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 @lmcd/gulp-svgo svgoUsage
import * as svgo from 'svgo';
import gulpSvgo from '@lmcd/gulp-svgo';
import { src, dest } from 'gulp';
export const minify = () => {
return src('svgs/*.svg')
.pipe(gulpSvgo(svgo))
.pipe(dest('dest'));
};gulp-svgo exports factory method with the following signature:
(svgo: svgo, options?: Record<string, any>)Where:
svgomust be the svgo package.optionscan be any key-value pairs, but as these are passed directly to SVGO'soptimizefunction, these should correspond with SVGO's configuration options.
Implementation notes
- By default, this plugin will disable the
removeViewBoxSVGO plugin. - This plugin does not fail if
svgoencounters 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.
