@lmcd/gulp-svgo

0.1.1 • Public • Published

@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.

Package Sidebar

Install

npm i @lmcd/gulp-svgo

Weekly Downloads

4

Version

0.1.1

License

MIT

Unpacked Size

6.14 kB

Total Files

4

Last publish

Collaborators

  • lachlanmcdonald