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

JSON config files #1497

Closed
mischnic opened this issue Jun 22, 2021 · 2 comments
Closed

JSON config files #1497

mischnic opened this issue Jun 22, 2021 · 2 comments

Comments

@mischnic
Copy link

mischnic commented Jun 22, 2021

Is your feature request related to a problem? Please describe.
Parcel's caching is most effective when config files are JSON files. The effective (=exported) value of JS config can change arbitrarily meaning that JS config files always have to be treated as "modified" and svgo has to be rerun for every file (even though the user didn't change anything).

For the first config example in the readme, a JSON file would suffice (so a svgo.config.json):

{
  "multipass": true,
  "datauri": "enc",
  "js2svg": {
    "indent": 2,
    "pretty": true
  }
}

Describe the solution you'd like
But for disabling a single plugin, either extendDefaultPlugins need to be used, or all plugins need to be listed.

const { extendDefaultPlugins } = require('svgo');
module.exports = {
  plugins: extendDefaultPlugins([
    {
      name: 'builtinPluginName',
      active: false
    }
  ])
}

What's missing is a way to achieve what extendDefaultPlugins does but without needing a JS config file. So for example something along the lines of:

{
  "pluginsOverride": [
    {
      "name": "builtinPluginName",
      "active": false
    }
  ]
}

Additional context
Trying to avoid having to invent our own svgo config file format for Parcel...

@TrySound
Copy link
Member

Added preset-default plugin and deprecated extendDefaultPlugins utility here
#1513

@TrySound
Copy link
Member

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

No branches or pull requests

2 participants