Skip to content

LearnAllTheNodes/episode00009

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learn All The Nodes Episode 9

View templates in Node.js with Jade

View the episode

Our days of writing inline HTML snippets inside our route handlers are over! You may have enjoyed dealing with files several hundred columns wide, and you're free to continue doing so, but that is not the direction this series is going to take.

We're going to see how Express supports view template engines, and we'll look at the Jade template engine in particular. Jade is similar to HAML, if you've ever used that, and it is a sort of short-hand for writing HTML. It lets us get more HTML with less code by removing the need for closing tags (using indentation to indicate parent-child relationships), removing the need to ever type div, and other tricks. In addition, it also lets us embed JavaScript evaluation so that we can have dynamic content.

This is 1 of a 2-part series on Jade, so be sure to come back next week as well for some more advanced features.