doctype html
html(lang="en")
head
title= pageTitle
script(type='text/javascript').
if (foo) bar(1 + 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.
然後在命令列裡,使用pug命令將其轉義成真正的html:
pug -P test.pug
然後就自動產生了這個樣子的html:
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<script type="text/javascript">if (foo) bar(1 + 5)</script>
</head>
<body>
<h1>Pug - node template engine</h1>
<p 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>
</p>
</body>
</html>
你說的寫好應該是「編輯器」吧? ^^,能在「編譯器」裡寫好程式碼的,想必應該很屌!
而且現在好像也不叫
jade
,改叫:pug
了。開啟一個命令列,先安裝
pug
指令工具:然後寫一個
pug
的範本:test.pug
然後在命令列裡,使用
pug
命令將其轉義成真正的html
:然後就自動產生了這個樣子的
html
:html
該怎麼用,不用我教吧?當然我介紹的這是小白入門。高階用法,都是都是整合在其他專案建置工具裡的。慢慢來吧,一口氣一定吃不成個胖子