Skip to content
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

Tradeoffs between handlebars partials and get helper stink #10

Open
mkantor opened this issue Sep 3, 2020 · 2 comments
Open

Tradeoffs between handlebars partials and get helper stink #10

mkantor opened this issue Sep 3, 2020 · 2 comments
Milestone

Comments

@mkantor
Copy link
Owner

mkantor commented Sep 3, 2020

Currently the get helper and handlebars partial syntax ({{> blah}}) serve similar purposes (including content from other files), but they don't fully overlap:

  • Both can embed content from other templates.
  • The get helper can also embed content from executables or static files, but partials can't.
  • Handlebars partials can pass parameters and/or a block to included templates, but get can't.
  • get is passed a route, but partial syntax uses filesystem paths ({{get "/foo/bar"}} vs {{> foo/bar.html.hbs}}).
  • Handlebars partials have the concept of an "inline partial", and there's no analogue for get.

This is confusing and annoying. It would be great to eliminate these tradeoffs so that you don't need to think about when to use each one, either by combining them or making one a superset of the other.

@mkantor mkantor added this to the 1.0 milestone Sep 3, 2020
@mkantor
Copy link
Owner Author

mkantor commented May 8, 2021

I'm betting the easiest approach here will be to enhance get to make it able to do a superset of what partials can do.

Last time I checked the handlebars-rust library didn't provide an easy to way to extend built in functionality like >. Even if I could do that it'd make templates less portable.

@mkantor
Copy link
Owner Author

mkantor commented Jul 15, 2021

Steps to enhance the get helper so its behavior is a superset of what partials can do:

mkantor added a commit that referenced this issue Dec 29, 2021
This isn't used yet, but will allow the helper to modify the context
(useful for #10).
mkantor added a commit that referenced this issue Jan 2, 2022
This isn't used yet, but will allow the helper to modify the context
(useful for #10).
mkantor added a commit that referenced this issue Jan 2, 2022
This isn't used yet, but will allow the helper to modify the context
(useful for #10).
mkantor added a commit that referenced this issue Jan 2, 2022
This isn't used yet, but will allow the helper to modify the context
(useful for #10).
mkantor added a commit that referenced this issue Jan 2, 2022
This isn't used yet, but will allow the helper to modify the context
(useful for #10).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant