Day018 — pug(formerly jade)

I tried to learn pug, formerly jade, for the template engine of my nodejs project. I think it is quite easy to learn as the syntax is straight forward.

Below four points are the benefits I consider quite usable after the first try:

  1. have inheritance (“extends”, have parent and child concept)
  2. can use “maxins” as reusable function (minimize code size)
  3. use intent for scoping (like python, don’t have the ugly and useless closing tag)
  4. can mix with js code (but have quite limited usage, but better than nothing). e.g.
- var tabs = ["tab1", "tab2", "tab3"];
- for (var i= 0; i< tabs.length; i++)
li tab

=>

<li>tab1</li>
<li>tab2</li>
<li>tab3</li>

— — — — — — — — — — — — — — — — — — — — — — — — — —

Document for pug:

— — — — — — — — — — — — — — — — — — — — — — — — — —

A great syntax doc for jade:

— — — — — — — — — — — — — — — — — — — — — — — — — —

CLI (command language interpreter) for pug

— — — — — — — — — — — — — — — — — — — — — — — — — —

How to have a conditional class added or removed:

option 1:

option 2:

— — — — — — — — — — — — — — — — — — — — — — — — — —

BTW, I watched a youtube video talking about what to learn as a web developer, either you are a noobie or an expert. He listed out all web-related technology, from frontend to backend, and stated which one he recommend to pick up or at least know about it. I think the list he gave is a very good reference for anyone want to be keep up with the trend in Web world.

The presentation tool he used, coggle.it, seems really cool too.