我正在使用Assemble和Handlebars来生成静态站点。我有几个页面使用相同的总体布局,但有几个例外情况{{> body}}
需要添加主页面之外的内容。
鉴于此通用页面结构:
<html>
<body>
<section>{{> body}}</section>
<!-- global scripts -->
</body>
</html>
以及需要在andindex.html
之间添加标记,最好的方法是什么?<!-- global scripts -->
</body>
如果我像这样在我的 Gruntfile 中包含一个部分:
index: {
options: {
partials: ['source/partials/home/**/*.hbs'],
},
files: [{
expand: true,
cwd: 'source/pages/',
src: '**/index.hbs',
dest: 'output/'
}],
},
此部分可用于assemble
任务中的所有其他后续项目,我当然不想要。如果这只是一个变量,我可以在 YML 前端或类似的东西中做到这一点,但它是 HTML 和内联 JS 的块,因此比我想放在前端的要多一点。我也无法通过 JS 加载此标记,因为它需要阻塞。