jstransformers / jstransformer

Normalize the API of any JSTransformer.
http://npm.im/jstransformer
MIT License
153 stars 12 forks source link

PostHTML #139

Closed RobLoach closed 8 years ago

RobLoach commented 8 years ago

https://github.com/posthtml/posthtml

voischev commented 8 years ago

@RobLoach :+1:

RobLoach commented 8 years ago

Looks like a very cool project!

voischev commented 8 years ago

@RobLoach Thx! :)

ForbesLindesay commented 8 years ago

That looks very cool indeed. Love that this also supports a "sync" mode if plugins are synchronous. Do you have any thoughts about adding a pretty-printer? I'd love to just use this to handle jade's pretty mode and remove pretty printing from jade-core.

voischev commented 8 years ago

maybe you create posthtml-pretty-print plugin? But pretty-print need after call all PostHTML plugins. Or if you don't change pretty structure, use jade+pretty+posthtml :)

jade+pretty > posthtml+plugins > html example use jade+posthtml https://github.com/rajdee/posthtml-bem#with-jade-and-gulp

RobLoach commented 8 years ago

@ForbesLindesay Another option is piping it through js-beautify, or jstransformer-html-beautify. Having it passed through the PostHTML tree as a posthtml-pretty-print plugin would be much faster, though.

voischev commented 8 years ago

@RobLoach :+1:

ForbesLindesay commented 8 years ago

Yes, something like js-beautify, or jstransformer-html-beautify would work fine, and is what I'm currently thinking. I just thought using PostHTML to do pretty pringing might have perf wins as we could potentially directly generate a PostHTML AST and have people run plugins before we pretty print.

@voischev The main objective here is to remove the pretty printing option from jade, so doing pretty printing as part of jade doesn't really make much sense.

RobLoach commented 8 years ago

https://github.com/jstransformers/jstransformer-posthtml