我正在转向磁带的第 2 版。
但是我在网上找不到任何东西可以帮助我配置我的盒式磁带来编译HTML模板。
模板
一些模板 jQuery 模板为:
<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="header" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="header">${header}</h3>
</div>
<div class="modal-body">
{{html body}}
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal">${CancelText}</button>
<button class="btn ${ClassBtn}">${ConfirText}</button>
</div>
</div>
我将尽快修改它们以使用 jsRender!
其他作为敲除JS的
<div class="span2">
<div class="data-block">
<h4 data-bind="text: Total"></h4>
<h6>
<span data-bind="text: Passo.Nome"></span>
<small class="muted" data-bind="text: Passo.Responsavel">Riderman de Sousa</small>
</h6>
</div>
</div>
IConfiguration<BundleCollection>
类
bundles.AddPerSubDirectory<HtmlTemplateBundle>("HtmlTemplates", b => b.Pipeline = ??? );
我实际上找到了答案,使用 v2 一切都是分开的。因此,如果您使用Less,则必须获得Cassette.Less nuget软件包。与 tmpl 项目相同。
1 ) 获取 Nuget 包:http://nuget.org/packages/Cassette.KnockoutJQueryTmpl/2.0.0
2 ) 配置:
public class CassetteConfiguration : IConfiguration<BundleCollection>
{
readonly KnockoutJQueryTmplPipeline pipeline;
public CassetteConfiguration(KnockoutJQueryTmplPipeline pipeline)
{
this.pipeline = pipeline;
}
public void Configure(BundleCollection bundles)
{
bundles.Add<StylesheetBundle>("Content", new FileSearch { Pattern = "*.css;*.less", SearchOption = System.IO.SearchOption.AllDirectories });
bundles.Add<ScriptBundle>("Scripts");
bundles.AddPerIndividualFile<ScriptBundle>("Content/js");
bundles.Add<HtmlTemplateBundle>("HtmlTemplates", new FileSearch { Pattern = "*.htm" }, b => b.Pipeline = pipeline);
}
}
3 ) 在视图中引用捆绑包
Bundles.Reference("HtmlTemplates");