【发布时间】:2018-05-18 22:33:00
【问题描述】:
我有一个文件includes/mixins.pug,其中包含一些混入。我还有一个主布局文件layouts/default.pug,我是extend-ing。如何在我的布局文件中包含这些 mixin,这样我就不必在每个页面上都写 include includes/mixins?
例如,这就是我必须为每个额外的 pug 文件做的事情。在这种情况下:new_page.pug
extends layouts/default
include includes/mixins
block content
+my_mixin('Hello World')
layouts/default.pug
doctype html
html(lang=$localeName)
block vars
head
meta(charset="UTF-8")
meta(http-equiv="X-UA-Compatible" content="IE=edge")
meta(name="viewport" content="width=device-width, initial-scale=1.0")
block styles
link(rel="stylesheet" type="text/css" href="/assets/css/styles.min.css")
body
block content
如何在layouts/default.pug 中包含mixin?我在文档中找不到解决方案。
【问题讨论】:
标签: javascript html pug