
Show HN: JavaScript template literals as viewing engine in Node.js - Lanti
https://github.com/DJviolin/template-literals-demo
======
Lanti
In the past I used Handlebars, Nunjucks for viewing engine. So far I happy
with Nunjucks, but yesterday I thought maybe it's possible to use pure
template literals (why not?) for backend rendering in Node.js.

I created this little Koa v2 demo app, where I made similar view file
structure like if it was a Handlebars or Nunjucks templates. So far the
biggest difficulty for me was to pass down a value from a router to a sub-
component, without referencing that file in the router or another sub-views
more than once in the entire app. Now I passing "down" the variables from the
router file to the deepest referenced sub-component with an object in the
function arguments.

Any Koa v2 or Express templating best practices are broken (ctx.state also),
because not just the viewing engine, but also not in use any template
rendering middleware, like koa-views.

Any suggestions are highly welcome!

