jade-包含

模板继承是子文件,父文件继承和代码复用的问题,那模版包含是文件与文件之间,文件与区块之间,这种区块内嵌的东西

继承的关键字是extends, 那模板包含使用的是include这个关键字

head.jade
meta(charset='utf-8')
title layout

layout.jade

html
    head
        include head.jade
    body
      block descript
      p from layout
     block content        
index.jade
extends layout.jade
block content
  block descript
    p desc from index
  include title.html
title.html
<div>
  <p>hahahs</p>
</div>

=>

index.html
<html>
  <head>
    <meta charset="utf-8"/>
    <title>layout</title>
  </head>
  <body>
    <p>desc from index</p>
    <p>desc from index</p>
    <
div>       <p>hahahs</p>     </div>   </body> </html>
在jade里面引用html,加上后缀名html,jade就不会当作jade来编译
 
 
原文地址:https://www.cnblogs.com/wzndkj/p/9292576.html