Jade —— 模板引擎

开始装jade

安装npm包管理工具,在node环境下,并安装grunt开展工作

1
npm install jade -g

编写jade文件,编译成html

熟悉jade规范

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
doctype html
html(lang="en")
head
title= pageTitle
script(type='text/javascript').
if (foo) {
bar(1 + 5)
}
body
h1 Jade - node template engine
#container.col
if youAreUsingJade
p You are amazing
else
p Get on it!
p.
Jade is a terse and simple
templating language with a
strong focus on performance
and powerful features.

以上代码通过jade编译为html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE html>
<html lang="en">
<head>
<title>Jade</title>
<script type="text/javascript">
if (foo) {
bar(1 + 5)
}
</script>
</head>
<body>
<h1>Jade - node template engine</h1>
<div id="container" class="col">
<p>You are amazing</p>
<p>
Jade is a terse and simple
templating language with a
strong focus on performance
and powerful features.
</p>
</div>
</body>
</html>

Jade
Jade —— 源于 Node.js 的 HTML 模板引擎
jade学习
带你学习Jade模板引擎

文章目录
  1. 1. 开始装jade
  2. 2. 熟悉jade规范
,