Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify which SVGO plugins to use #53

Closed
hacknug opened this issue Aug 1, 2018 · 3 comments
Closed

Specify which SVGO plugins to use #53

hacknug opened this issue Aug 1, 2018 · 3 comments

Comments

@hacknug
Copy link

hacknug commented Aug 1, 2018

Is there any way to enable/disable specific SVGO plugins using the config file? Right now my .htmlnanorc looks like this:

{
    "minifySvg": false
}

And I'd like to have something like this:

{
    "minifySvg": {
        "plugins": [
            { "removeViewBox": false }
        ]
    }
}
@maltsev
Copy link
Member

maltsev commented Aug 2, 2018

htmlnano doesn't support .htmlnanorc yet. But you can configure SVGO plugins the following way:

var htmlnano = require('htmlnano');
var options = {
    minifySvg: {
        plugins: [
            { convertColors: false }
        ]
    } 
};

var svg = '...';

htmlnano
    .process(svg, options)
    .then(function (result) {
        console.log(result.html);
    });

@maltsev maltsev closed this as completed Aug 2, 2018
maltsev added a commit that referenced this issue Aug 3, 2018
In #53 I has been asked about disabling SVGO optimizations.
So I think it'll be nice to add a related test to check that.
@hacknug
Copy link
Author

hacknug commented Aug 3, 2018

Just fyi (in case you didn't know already), Parcel allows you to use such .htmlnanorc so maybe it would be a good idea to do something about it. I don't know much about the project but I can help if you're interested in doing something about it.

Since it seems like this is something related to Parcel (at least for now), I'll open an issue there to discuss how this should be done so that file allows users to enable/disable just some of the plugins.

Thanks!

@maltsev
Copy link
Member

maltsev commented Aug 5, 2018

I don't know much about the project but I can help if you're interested in doing something about it.

I'm definitely interested and I'll appreciate your help! Though, I don't have spare time right now to implement that myself, but I'll accept your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants