pug HTML模板引擎安裝編譯

2021-08-11 15:08:28 字數 980 閱讀 9348

最近專案裡用到 pug 而且感覺用著也很爽,寫起html 來要輕便很多,順便研究了下編譯

pug 原名 jade ,搜尋pug 相關的資料很少,所有在這裡記錄下

1、首先要通過node.js的npm來安裝pug,直接在cmd裡面輸入npm install -g pug 前提是你安裝了node和npm (網上安裝教程很多,這裡就不贅述了),還需要安裝cli npm install -g pug-cli ,不然會出現pug not found。 -g表示全域性安裝

2、寫乙個test.pug檔案,在cmd裡進入test.pug的目錄下,輸入pug test.pug 回車即可出現rendered test.html。輸入pug -p -w test.pug比較好,因為輸出的html格式會好看,並且是被監聽的,修改test.pug的時候,只要儲存,html會及時更新。

test.pug簡單**如下:

head

meta(charset='utf-8')

title first file

of pug

body

h1 this is

myfirst pug

div

.div1

p that

some content in here

i point

編譯完成後的html

charset="utf-8">

first file of pugtitle>

head>

class="div1">

div>

that some content in herepointi>

p>

div>

body>是不是少寫了不少**

pug HTML模板引擎安裝編譯

剛開始學pug的時候有點不明白,然後各種搜尋,後來才知道pug就是jade,原名叫jade,現在更名為pug而已。可能剛改名沒有多久吧,搜pug資料很少。我也剛開始學習,希望對大家會有幫助。1 首先要通過node.js的npm來安裝pug,直接在cmd裡面輸入npm install g pug 前提...

規則引擎 Drools 模板編譯

org.droolsgroupid drools templatesartifactid 7.7.0.finalversion dependency 新建模板檔案 test.drt template header condition execution package template templa...

NVelocity模板引擎

因此決定自學一下nvelocity的使用 拋開monorail 安裝後,在其下的bin目錄中可找到nvelocity.dll net專案中將用到 並將其複製出來放到我的測試web bin目錄下。到castleproject上看了一下using it大致有四步 先要引入以下命名空間 using com...