jstransformer icon indicating copy to clipboard operation
jstransformer copied to clipboard

Switch to Unified API

Open RobLoach opened this issue 8 years ago • 2 comments

https://www.npmjs.com/package/unified

Would end up being like the following:

var jade = jstransformer().use(jade);
var output = jade.process(input);

Or https://github.com/jonschlinkert/base-methods may be another option.

Using this API would allow easy piping between the Transformers.

RobLoach avatar Dec 28 '15 19:12 RobLoach

Personally, I think piping should be a higher level concern, not something we handle at this level. Our transform's uniform interface is a string, rather than an AST, so we don't need to think about splitting out parse/compile stages. I think we should avoid the added complexity.

ForbesLindesay avatar Feb 08 '16 14:02 ForbesLindesay

I think we should avoid the added complexity.

:+1:

@RobLoach Also, i thought for it when you posted the issue, but. Can you show some example (with multiple transformers) and what you would expect?

It would be too complex to be implemented, even without unified, base, use or any other thing like that.

I can think only for one example that may be useful: str -> Rework (or some pre-processor) -> PostCSS -> output

Or okey, another think... str -> [mustache ->] handlebars -> htmlmin -> output, but what if one jstransformer supports only async api? And more questions pops up, imho.

tunnckoCore avatar Feb 11 '16 18:02 tunnckoCore