-
Notifications
You must be signed in to change notification settings - Fork 89
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 ourterms of serviceand privacy statement.We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Defining subtemplates within a template? #123
Comments
This not to add more complexities or logics, but rather breaking down html structure rendering into own methods, so it's clearer which method/subtemplate to check when we need to. For me it's easier to read method names before going to the method to check the impl details (below is not method names yet, only prototype names, but the reasoning is the same):
For rendering form and it's inputs, i could place them into their own reusable templates. But for table and subtables, whose rendering logic might be a bit long - making it hard to mental model which is doing what, and since its only used for this template: breaking it down within the same template means easier to read and go deep as needed. |
@albert-kamI'm certainly open to the idea and thought of that myself when originally developing the framework. I ended up punting on the concept due to the additional parsing rules and code generation necessary to get it to work. In my own projects, I just place these templates in their own template file and reuse them that way. If you wanted to take a stab at implementing it, I'd be very open to a PR that did that. |
Hi, im currently learning rocker, and very much impressed with it at the moment.
I'm just curious whether it's possible to define a subtemplate within a template, for the sake of visibility and without having to switching opened file.
The use case is simple, looping to create a html table, with each row rendering moved to a single subtemplate. Pretty much like refactoring a method to another method to avoid a big fat method.
Thank you!
The text was updated successfully, but these errors were encountered: