Episode 8 – Serving Content in Koajs with Marko
By James Moore
In this episode we'll look at Marko a relatively new and fast templating engine available in Node.js and in the browser.
There are over two dozens choices in templating engines available in node.js, and figuring out which one to use can be quite the burden.
Here is my advice, you must consider Marko!
I believe that I can prove why Marko is so great within the first 2 minutes of this screencast. Marko has several killer features that set it apart:
- Marko offers streamed template rendering, which sends your html content to the browser early and often.
- Marko supports asynchronous rendering of html fragments, which basically means you define sections of your template as asynchronous and you let Marko handle the waiting, buffering and eventual rendering.
These three features in combination result in huge gains in perceived and actual loading performance particularly when used on multi-page web applications that serves dynamic content.
The reason for the significant performance gains is because Marko is designed to leverage Progressive Rendering in the browser, a feature supported by all modern browsers.
The idea behind Progressive Rendering is that the browser should attempt to paint or render as much of the page as can as early as possible.
You should really watch to demo to get a sense of why Progressive Rendering and Marko are so important.
Source for this episode is available at https://github.com/knowthen/episode-8-serving-content-in-koajs-with-marko