Episode 8 – Serving Content in Koajs with Marko

Author: 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.
  • Marko offers out of order rendering while still displaying the html content in correct order. This means that as soon as your asynchronous queries complete, Marko will render the relevant portions of the template and send it to the browser, even if this means sending the content out of the final display sequence. Then Marko displays the content in the correct sequence by using client side JavaScript.

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

Free Courses

Functional Concepts in JavaScript with Ramda

What's Ramda?

In this free mini-course, you'll learn about functional programming concepts like: map, filter, reduce, curry and function composition.

This is a great course for dipping your toes into Functional Programming.

Price:Free ($0)
Sign Up

Elm for Beginners

What's Elm, and why should I care?

It's an amazing language for writing web apps which have no runtime exceptions.

I'm pretty sure learning Elm will change the way you program And It's Free!

Price:Free ($0)
Sign Up