【发布时间】:2014-02-26 14:00:27
【问题描述】:
我已加入assemble/Grunt 尝试改进我的工作流程,以便为我使用的 CMS 创建模板。我想弄清楚的是:是否可以在开发时(即,在“grunt watch”期间)在我的模板中使用 HTML 内容的块/部分,然后用我的 CMS 在最终的 HTML 输出(即当我执行“grunt build”时)。类似以下内容?
<div id="content">
{{! if in dev context, include this partial }}
{{#if}}
{{> body }}
{{! if in build context, include this partial }}
{{else}}
{{> body-cms-tag }}
{{/if}}
</div>
如果处于开发/监视模式,将输出
<div id="content">
<h1>Test Headline</h1>
<p>This is just test content.</p>
</div<
但在构建模式下,会输出
<div id="content">
<?php echo $mContext['bodyElements']; ?>
</div>
这可能吗,无论是使用 Handlebars 语法、Assemble 助手还是 Grunt 任务(类似于 grunt-usemin?)
【问题讨论】:
标签: gruntjs handlebars.js assemble grunt-assemble