pug 编译html,pug之HTML模板引擎安装编译教程
最近項目里用到 pug 而且感覺用著也很爽,寫起html 來要輕便很多,順便研究了下編譯
pug 原名 jade ,搜索pug 相關(guān)的資料很少,所以在這里記錄下
1、首先要通過node.js的npm來安裝pug,直接在cmd里面輸入npm install -g pug 前提是你安裝了node和npm (網(wǎng)上安裝教程很多,這里就不贅述了),還需要安裝cli npm install -g pug-cli ,不然會出現(xiàn)pug not found。 -g表示全局安裝
2、寫一個test.pug文件,在cmd里進(jìn)入test.pug的目錄下,輸入pug test.pug 回車即可出現(xiàn)rendered test.html。輸入pug -P -w test.pug比較好,因為輸出的html格式會好看,并且是被監(jiān)聽的,修改test.pug的時候,只要保存,html會及時更新。
test.pug簡單代碼如下:
doctype html
head
meta(charset='utf-8')
title First file of pug
body
h1 This is my first pug
p
.p1
p that some content in here
i point
編譯完成后的html
First file of pugThis is my first pug
that some content in herepoint
是不是少寫了不少代碼
總結(jié)
以上是生活随笔為你收集整理的pug 编译html,pug之HTML模板引擎安装编译教程的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: setPositiveButton和se
- 下一篇: JUC —— 常用辅助类
