Skip to content

Broccoli plugin for optimizing SVG files by SVGO with a persistent cache for fast restarts

License

Notifications You must be signed in to change notification settings

andrewpye/broccoli-svg-optimizer

 
 

Repository files navigation

broccoli-svg-optimizer

Build Status Build status

Broccoli plugin for optimizing SVG files by SVGO with a persistent cache for fast restarts.

Installation

npm install --save-dev broccoli-svg-optimizer

Usage

var SVGOptimizer = require('broccoli-svg-optimizer');
var outputNode = new SVGOptimizer(inputNode, {
  persist: false,
  svgoConfig : {
    plugins: [
      { removeTitle: true }
    ]
  }
});

Options

svgoConfig

Type: Object
Default: null

Enable\disable\configure SVGO plugins to customize SVG optimization. Most of the plugins are enabled by default. Check out SVGO repository for available options.

Example:

svgoConfig : {
  plugins: [
    { removeUselessStrokeAndFill: false },
    { removeAttrs: { attrs: '(fill|fill-rule)' } },
    { removeTitle: true },
    { removeDesc: { removeAny: true } },
  ]
}

persist

Type: Boolean
Default: true

Enable\disable a persistent cache to improve build performance across restarts. Check out broccoli-persistent-filter for more details.

Running Tests

npm install
npm test

License

This project is distributed under the MIT license.


GitHub @ivanvotti  ·  Twitter @ivanvotti

About

Broccoli plugin for optimizing SVG files by SVGO with a persistent cache for fast restarts

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%