I almost always write my templates in nearly the same way. If it is a list of things:
// want to condense this down into `list` component where there is a template content block
template(name="Users.List")
each users
+Users.ListItem
else
if subsReady 'users'
+NoDataFound message="No users found"
else
+Loading
If it’s a single entity, it’s usually like this:
tempate(name="User.Profile")
if subsReady 'users'
if data
+User._profile
else
+NoDataFound message="User not found."
else
+Loading
template(name="User._profile")
// some template here, like this
h1.title {{ name.first }}
So it’s a very standard, very simple pattern. All that really matters to me is:
- Good data binding (preferably two-way.)
- Easy hierarchical structures and componentization
What do you guys suggest?