0.1.1 • Published 3 months ago

@lmcd/gulp-svgo v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

@lmcd/gulp-svgo

Build npm version License

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's optimize 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.

0.1.1

3 months ago

0.1.0

9 months ago