Contents tagged with JavaScript

  • Make Your HTML Pages Dynamic Using Handlebars Templating Engine

    Technologies and methods for designing and developing web pages have come a long way and with a plethora of tools available at one's disposal, getting a minimal website is not a rocket science anymore. As web developers, we often face a dilemma to go for a static site using plain HTML or to go for a dynamic one with some server-side programming stack. Both of the approaches has got advantages as well as disadvantages. 

     If we go for a static one, the advantages are  

    1. Time needed for development is less.
    2. Easy to create and less expertise is needed 
    3. Site will be super fast 


    1. Hard to maintain 
    2. Lot of repetitive work 
    3. Hard to scale 

     And for the dynamic approach, advantages are 

    1. Easy to maintain 
    2. Repetitive work can be avoided 
    3. Scaling is easy and more features can be easily integrated 


    1. Dedicated personal  is needed 
    2. Cost factor increases 

    We can overcome some of the cons mentioned above by applying JavaScript Templating. JavaScript Templates helps to segregate HTML code and content which it is rendering in the browser. This separation of concerns helps to build a codebase which is easy to maintain in the future, modifications can be easily done with minimal disruption to the existing codebase. 

    Some of the most popular JavaScript templating engines are Mustache, Underscore, EJS, and Handlebars and in this post, I am going in detail to show how we can make of Handlebars to generate HTML content from the template.