Rookie’s Questions about JADE

  node.js, question

Can you tell me how the jade template works? How to run the test after the compiler inside has written it? It is the first time to use nodeJS, and the first time to use jade. I don’t quite understand it.

What you said should be “editor”? , can write good code in the “compiler” inside, presumably very good!

And now it doesn’t seem to calljade, changed to call:pugHere we go.

Open a command line and install firstpugCommand tools:

npm install pug-cli -g

If yes or nowindowsThe operating system, plussudo

Then write onepugTemplate for:

test.pug

doctype html
 html(lang="en")
 head
 title= pageTitle
 script(type='text/javascript').
 If (foo) bar(1 plus 5)
 body
 h1 Pug - node template engine
 #container.col
 if youAreUsingPug
 p You are amazing
 else
 p Get on it!
 p.
 Pug is a terse and simple templating language with a
 strong focus on performance and powerful features.

Then at the command line inside, use thepugCommand to escape it to realhtml:

pug -P test.pug

And then automatically generated this appearancehtml:

<!  DOCTYPE html>
 <html lang="en">
 <head>
 <title></title>
 < scripttype = "text/JavaScript" > if (foo) bar (1 plus 5)</script >
 </head>
 <body>
 <h1>Pug - node template engine</h1>
 <div class="col" id="container">
 <p>Get on it!  </p>
 <p>
 Pug is a terse and simple templating language with a
 strong focus on performance and powerful features.
 </p>
 </div>
 </body>
 </html>

htmlI don’t need to teach you how to use it.

Of course, this is the introduction of Xiaobai. High-level usage is integrated into other project building tools, inside. Take your time, you can’t eat a fat man at one breath.