You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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):
render page
loop render table
loop render subtable
render global error message
render form
render input text
render input email
render submit button
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-kam I'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: