Wednesday, June 3, 2015

Latest web tool-template engine

Creating a static HTML page similarly is simple. However, if you have multiple HTML pages to handle in your project, things could get out of hand. Most of these pages may share the same components such as a Header, Sidebar, and Footer.
If you change something in the Sidebar, should you change it for the Sidebar in the other pages, one by one, or use a Template Engine instead?
Using a Template Engine sounds better for this situation. There are now a number of Template Engines that we can use, such as Kit, Jade, and Handlebars. Each has its own writing conventions. Kit, for instance, comes only with Variables and Import capability which are declared with a simple HTML comment tag, like so.

// example of importing a seperate template
<!-- @include inc/partial -->
// this is a variable
<!-- @var: The Variable Value -->
Jade and Handlebars come with a lot of robust features to cater to more complex projects. We will discuss them in more detail in a separate post (stay tuned!). The point is that if you want to build a scalable static website, you should take advantages of a Template Engine.

No comments:

Post a Comment