Closed RobLoach closed 8 years ago
@RobLoach :+1:
Looks like a very cool project!
@RobLoach Thx! :)
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.
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
@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.
@RobLoach :+1:
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.
https://github.com/posthtml/posthtml