You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@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?
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.
Maybe this should be a CLI option so that this change doesn't affect the configuration and posthtml the library. In that case we can do --use.priority low (default to high to preserve the current behavior).
...there is no way to run posthtml-extends and posthtml-markdown at the end.
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 posthtml-extends as the first plugin? (again imagine you have a loop with extends)
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 flags.use) to let the config file dictate the order.
Users can then use https://github.com/post/post-sequence to decide when to execute flags.use.
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?
Activity
giuseppeg commentedon Aug 20, 2020
Maybe this should be a CLI option so that this change doesn't affect the configuration and
posthtmlthe library. In that case we can do--use.priority low(default tohighto preserve the current behavior).Scrum commentedon Aug 22, 2020
@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
giuseppeg commentedon Aug 22, 2020
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
With our recent changes (#319) these plugins are always first and if you also have an external configuration...
...there is no way to run
posthtml-extendsandposthtml-markdownat the end.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
posthtml-extendsas the first plugin? (again imagine you have a loop with extends)Scrum commentedon Aug 22, 2020
@giuseppeg What do you think about 👇
giuseppeg commentedon Aug 22, 2020
@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
pluginsobject fromflags.use(see https://github.com/posthtml/posthtml-cli/pull/319/files#diff-532c51740b320dd4ec5143dd090e5d5aR25) so the plugins set via CLI arguments will always have precedence.Scrum commentedon Aug 23, 2020
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.
giuseppeg commentedon Aug 23, 2020
In theory we could change how we merge the plugins (config file and
flags.use) to let the config file dictate the order.Users can then use https://github.com/post/post-sequence to decide when to execute
flags.use.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?
Scrum commentedon Aug 26, 2020
I think it's worth trying to add the package
post-sequenceinto the general system under the flag ofsequence: true|falsewhat do you think of it ?