CanJS:如何打包用于生产的视图模板

CanJS: how to package view templates for production

为生产使用打包视图模板的最佳方式是什么?

我有很多 .stache 文件。在开发中,它们与 can.view() 同步加载。在生产中我想避免多个 HTTP 请求。

正确的做法是什么?我应该将它们捆绑为单个 html 文件还是单个 js 文件? StealJS 使用哪种格式?

这就是我创建 can-compile 的目的。例如

can-compile **/*.stache --out views.combined.js --can 2.1.0

将当前文件夹和所有子文件夹中的所有 Stache 文件编译到 views.combined.js

如果您使用 Steal 和 latest steal-tools(目前正在等待发布)并导入您的模块,例如将 ES6 与

一起使用
import template from 'my/template.stache!';

视图将自动构建到生产包中(并在开发中异步加载)。