Skip to content
This repository has been archived by the owner on Dec 23, 2019. It is now read-only.

[DEPRECATED] — Svgo implementation of SVG Cleaner provider

License

Notifications You must be signed in to change notification settings

ovh-ux/ovh-iconlib-provider-svg-cleaner-svgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Icon Library - SVG cleaner - SVGO

Build Status Coverage Status

SVGO implementation of SVG cleaner base provider

Installation

npm install --save "ovh-iconlib-provider-svg-cleaner" "ovh-iconlib-provider-svg-cleaner-svgo"

Configuration

#config.yml
---
 svg-cleaner:
   default: svgo
   providers:
     -
       name: svgo
       type: ovh-iconlib-provider-svg-cleaner-svgo
       plugins:
         - ovh-iconlib-provider-svg-cleaner-svgo/lib/plugins/agressiveCollapseGroups
         - ovh-iconlib-provider-svg-cleaner-svgo/lib/plugins/removeClipPaths
         - ovh-iconlib-provider-svg-cleaner-svgo/lib/plugins/cleanStyles

Usage

// default instance loaded according to the configuration
const svg = require('ovh-iconlib-provider-svg-cleaner').getInstance();

const dirty = '<svg xmlns="http://www.w3.org/2000/svg">...</svg>';
const pristine = '<svg xmlns="http://www.w3.org/2000/svg">...</svg>';

svg.clean(dirty)
    .then(result => {
        if (result !== pristine) {
            throw new Error('something went wrong');
        }

        ...
    });