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
该怎么用,不用我教吧?当然我介绍的这是小白入门。高阶用法,都是都是集成在其他项目构建工具里的。慢慢来吧,一口气肯定吃不成个胖子