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

Allow loading config from file in API #1327

Closed
climech opened this issue Feb 16, 2021 · 2 comments
Closed

Allow loading config from file in API #1327

climech opened this issue Feb 16, 2021 · 2 comments

Comments

@climech
Copy link

climech commented Feb 16, 2021

Being able to share the same config file between the CLI tool and API would simplify things a little bit. I only had limited time to look through the source, but it looks like the code for the --config option in lib/svgo/coa.js could be moved to a separate function and exposed to the API.

Big thanks for all your work, btw!

@TrySound
Copy link
Member

Yeah, I'm thinking about this. Though it will be only svgo.config.js. JSON and YAML support will be removed to make the package small.

TrySound added a commit that referenced this issue Feb 16, 2021
Ref #1327

Config file now can only be js. `svgo.config.js` is searched by default.
Otherwise any js module specified in `--config` cli flag.

Config loader is exposed in entry point as `loadConfig(configFile, cwd)`.
TrySound added a commit that referenced this issue Feb 16, 2021
Ref #1327

Config file now can only be js. `svgo.config.js` is searched by default.
Otherwise any js module specified in `--config` cli flag.

Config loader is exposed in entry point as `loadConfig(configFile, cwd)`.
TrySound added a commit that referenced this issue Feb 16, 2021
Ref #1327

Config file now can only be js. `svgo.config.js` is searched by default.
Otherwise any js module specified in `--config` cli flag.

Config loader is exposed in entry point as `loadConfig(configFile, cwd)`.
@TrySound
Copy link
Member

Added loadConfig utility in v2

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