jacobmischka / gatsby-plugin-react-svg

Adds svg-react-loader to gatsby webpack config
https://www.npmjs.com/package/gatsby-plugin-react-svg
MIT License
70 stars 21 forks source link

WIP filter removals #15

Closed gregorskii closed 5 years ago

gregorskii commented 5 years ago

updates config to allow options to be passed, and parsed through ruleProps then applied correctly to use loader config specifically plucks includes, excludes, filters, and new key omitKeys to be used to setup svg-react-loader config since filters are quite complex adds a simple key 'omitKeys' to allow end users to quickly remove keys that are problematic from their svg files lets filters remain in place if they are passed in directly allows config to define its own filters per the docs

gregorskii commented 5 years ago

Also one would use it as such, I can PR/add some docs once you check it out:

{
    resolve: `gatsby-plugin-react-svg`,
    options: {
        rule: {
            include: /images\/.*\.svg/,
            omitKeys: ['xmlnsDc', 'xmlnsCc', 'xmlnsRdf', 'xmlnsSvg', 'xmlnsSodipodi', 'xmlnsInkscape']
            ///OR
           filters: [function(value) { console.log(value); }]
        }
    }
},
jacobmischka commented 5 years ago

Looks great, thanks so much!

jacobmischka commented 5 years ago

Provides solution for #10.