-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Plugins priority for config and CLI args #322
Comments
Maybe this should be a CLI option so that this change doesn't affect the configuration and |
@giuseppeg I like the idea itself, but I think we are not fighting a problem. What are you trying to prioritize? In fact, there should not be any priority as such, there is an order that must be followed for a correct transformation. https://github.com/post/post-sequence
I will gladly accept your request if another idea does not suit you |
I am writing a CLI that wraps posthtml-cli and adds two plugins via arguments. So users install and run my CLI and internally I invoke posthtml -u posthtml-extends -u -posthtml-markdown With our recent changes (#319) these plugins are always first and if you also have an external configuration... posthtml -u posthtml-extends -u -posthtml-markdown -c posthtml.config.js ...there is no way to run I think that in this specific case it could be useful to run them at the end - imagine someone adds a plugin for loops and other expressions (https://github.com/posthtml/posthtml-expressions#loops). From your experience is it ok to run |
@giuseppeg What do you think about 👇
|
@Scrum as far as I understood that is to create a configuration object (which you write to a file) with a specific order. Basically that's something the end user would do but I am not sure if it'll work because we always start to construct the final |
this saves us from having to introduce the notion of priority as such, providing already correctly configured order of application of packages.
As I wrote earlier, if the priority system suits you more, namely, it gives the user the ability to customize the order according to the priority rules manually, then I will accept this option. |
In theory we could change how we merge the plugins (config file and Probably this is how it was in the beginning before we made the changes I suggested (sorry for that) - can you confirm? If that was the case.. what do you suggest we do? Another breaking change? |
I think it's worth trying to add the package what do you think of it ? |
@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 whetherconfig.plugins
are registered before or after plugins enabled via CLI?For example, given the following CLI invokation:
And
posthtml.config.js
: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.
The text was updated successfully, but these errors were encountered: