Skip to content

Plugins priority for config and CLI args #322

@giuseppeg

Description

@giuseppeg

@Scrum with my previous PR the declaration order of the plugin is now stable. Would you accept a new PR to add a config file option to configure whether config.plugins are registered before or after plugins enabled via CLI?

For example, given the following CLI invokation:

posthtml index.html -u posthtml-plugin-foo -c posthtml.config.js

And posthtml.config.js:

module.exports = {
  plugins: {
    priority: 'high', // default to 'normal' to preserve the current behavior
    ...
  }
}

It applies the plugins from the config file first and then the ones passed as CLI arguments.

My use case is the following: I am building a CLI that wraps posthtml-cli. When I call posthtml-cli I pass some default plugins via CLI arguments along with the rest of the original args. Since users can pass --config posthtml.config.js my plugins will always run first whereas in many cases it'd be better to run them at the end.

Happy to submit a PR if you like this idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions