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

Handling additional transform arguments #19

Open
rreusser opened this issue Nov 18, 2017 · 1 comment
Open

Handling additional transform arguments #19

rreusser opened this issue Nov 18, 2017 · 1 comment

Comments

@rreusser
Copy link
Member

rreusser commented Nov 18, 2017

html-inject-script, to name one example, exposes a transform function that accepts two arguments. Documentify is currently only capable of passing one argument. If you configure a transform like this:

"transform": ["html-inject-script", "bundle.js"]

It's invoked as htmlInjectScript("bundle.js"). Passing additional arguments would either look like this:

"transform": ["html-inject-script", "bundle.js", {"foo": "bar"}]

which would be invoked as htmlInjectScript("bundle.js", {"foo": "bar"}), which seems weird because the configuration has multiple arguments in parallel with the transform name. A breaking change would be for configuration to require array-wrapping all arguments always:

"transform": ["html-inject-script", ["bundle.js", {"foo": "bar"}]]

This is my favorite option since it's easy enough to infer that it's just running .apply(null, args) on the transform, though the single-argument case is a bit clumsy.

The third option is that all compatible transforms must only take one argument.

Thoughts on the best path forward?

@rreusser rreusser changed the title Additional transform arguments Handling additional transform arguments Nov 18, 2017
@yoshuawuyts
Copy link
Contributor

yoshuawuyts commented Nov 21, 2017

@rreusser I'd go with whichever syntax browserify is using; the less there's to learn, the easier it is C:

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

No branches or pull requests

2 participants