Node.js template showdown: JSHTML compared

Matthew Nuzum —  — Leave a comment

JSHTML provides an adaption of the razor view engine in Javascript. If you’ve used the Razor view engine for .Net languages then this could be the right template for you and your Node.js project. However, you’ll have to be more tenacious than I am, because the version bundled with Node.js is broken.

As a matter of fact, this will be quite a short review because I couldn’t find enough redeeming qualities to warrant the extra work to get it integrated.

By the way, this is one part of a 5 piece series, so if you want to explore other options, don’t forget to visit the series start where I explain the biases and summary information and link to all of the tutorials.

In order to get a feel I tried to write a quick application. I had intended for it to be based on Bootstrap and rendered entirely server side. You can download my source code for the example app on Github, but you won’t find much of value there, I couldn’t get it working.

As I mentioned in the series start, I strongly prefer logic-less templates. JSHTML requires you to use logic in your templates, which is a big strike against it for me. Also, I’m not a .Net developer, so I’ve never used the Razor view engine.

This library doesn’t seem to be very actively developed and as I mentioned above, the version included with Express is non-functional. I should file a bug to have it removed or updated.

Here is a run-down of the criteria I considered when doing my evaluation:

  • Built into Express? Yes, but broken (negative)
  • Allows logic in templates? Yes (neutral)
  • Encourages logic in templates? Yes (negative)
  • Reusable client side? Unknown
  • Allows bootstrap integration? Unknown
  • IDE support? Unknown
  • Partials support? No (negative)
  • Other notes: Not actively developed

Bottom line, would I recommend it: No.

I’ve also done the same comparison on Jade, EJS, Mustache and Handlebars or the series overview.

If you find this helpful, please share on your favorite social network! If you have suggestions or feedback, please leave a comment.

If it helped, please share!Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+

Matthew Nuzum

Posts Twitter Facebook

Web guy, big thinker, loves to talk and write. Front end web, mobile and UX developer for John Deere ISG. My projects: @dsmwebgeeks @tekrs @squaretap ✝