Closed milotoor closed 9 years ago
Yeah, when I wrote browserify-transform-tools, browserify didn't allow that second parameter, and there was much debate about whether it should or not over in the browserify repo. Now that they support it, we probably should, too; I think this is a much better way to pass options.
Alright, I'm happy to put together a pull request.
That would be awesome. :)
See #8. Criticism wholeheartedly welcome!
Published to npm. Enjoy! :)
Thank you!
Browserify's API for writing transforms allows transforms to accept two parameters: the
file
name, which is mandatory if the transform is to do anything meaningful; andtrOpts
, or transform options, which are optional but can be used by the transform if it so chooses.Presently, the
make*Transform
methods all return a function that accepts afile
parameter but notrOpts
. Consequently it's impossible for any parameters provided to the transform from somewhere upstream (i.e. via Browserify's ownb.transform
API, or a build tool such as grunt-browserify) to be processed by the created transform.I propose modifying the function signature of the
transform
function returned bymakeStringTransform
(seetransformTools.coffee
line 53) fromto
and to change the
transformOptions
fromto
Thoughts?