-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Update handlebars for htmlbars compat #188
Conversation
4769056
to
d97d9db
Compare
@patricklx this is looking pretty good; are there any changes you'd like to make to it before I merge it in? |
I think its ok. But block parameters are not supported, and htmlbars is already using them. But maybe not so important right now? I am using ember canary, i had to adapt the emblem-ember-cli compiler to use the emblem ast and input it to the htmlbars compiler. I was able to make it work with custom ast plugins for |
I'm really excited about what's happening here. @patricklx are you planning on adding the block param syntax soon? I took a look at handlebars-lang/handlebars.js@b8a9f72 and if you're not on it yet I can give a try hopefully this week. |
@patricklx I'm realizing something that may not bode very well for this PR... there are now three major Handlebars AST versions, and version 1 had breaking changes, and it's exhausting (and not very fruitful honestly) to depend on an ever-moving Handlebars AST when maybe it makes more sense for Emblem to output Handlebars text, which hasn't had a breaking changing throughout Handlebars' lifetime. I've run this idea by a few other Ember core team members (and Handlebars maintainers) and it seems like it might be the better way to go. It would mean that I wouldn't be able to use the code in this PR, so I wanted to take this opportunity to get your opinion on this and make sure I'm not missing some crucial detail before I make a rash decision; I appreciate the time you've put into prepping Emblem for the HTMLbars move, but I want to make sure we're not setting ourselves up for a black hole investment in maintaining an Emblem-Hbs dependency hell. |
Yes, i had the same feeling while working on this. I think the best would be to get rid of any handlebars ast inside of emblem and directly compile to html+handlebars expression. I think that would be way more maintainable. |
By |
Exactly |
If I understand correctly, Emblem still need to add the block param syntax support regardless what the output will be. It seems to me the amount of work of changing the output to Handlebars template is much more than just adding block params to this PR and things will just work now. @machty what do you think of adding block params support? do you expect this to take place before the output refactor? and lastly, is there a time frame the output change can happen? (I don't really expect an answer for this last one since people are working on this on their own time and I'm grateful this work can benefit the whole community.) |
I am with @lai here, not to pressure anyone (or sound ungrateful) but I just think that this PR is "almost done", and it would be a waste to not add block params (which would benefit many people, including me of course :) ) and change the inner workings after that. |
How is it? @lai, are you working on blockParams? Somehow i thought blockParams are a requirement for using htmlbars, but they are not. We just need an extra step to transform I adapted the broccoli-emblem-compiler . I took another approach in the each/with-transform... well, i thought only blockParams work. Anyway, by creating handlebars source we could also go around this issue? Is someone already working on creating a Emblem->handlebars source version? |
The Handlebars and HTMLBars AST are not stable yet. The string strategy seems correct to me at least until then. |
@patricklx I'm working on the Emblem->Hbs source. I don't think I can use any code from this PR, so closing for now. I really really really appreciate the work and wished we'd figured it out sooner that targeting Handlebars text was the better way to go. |
ok, no problem! From what i saw, the problem is that a whole line will be matched at once, if one part fails, all fails. |
A lot of that is tied to the PEG parser; could you take a look at PEG.js and see if there's been some improvements in this area? |
ok. I did read something some days ago: here it is: pegjs/pegjs#262 |
Nice... would be interested in a PR for that if it definitely improves the experience :) |
WIP, needs some help/review and discussion :)
current htmlbars handlebars goes to commit handlebars-lang/handlebars.js@3238645
I started by renaming AST names, which maybe wasn't the best idea, didn't expect many changes
summary/todo:
By AST:
close
parameter replaced byopenStrip, inverseStrip, closeStrip
handlebars-lang/handlebars.js@eee2c4d handlebars-lang/handlebars.js@928ba56