使用 grunt-ts 将 .html 模板转换为 AMD 模块
Turning .html templates into AMD modules with grunt-ts
使用 grunt-ts
和 html: ["*.tpl.html"]
选项,它最终将 *.tpl.html
个文件编译成 *.tpl.html.js
个文件,它设置了全局 var
。
我可以告诉 grunt-ts
以不同的模块语法(例如 AMD 或 CommonJS)输出最终的 .js
文件(以避免使用全局变量)吗?
Can I instead tell grunt-ts to output the final .js file in a different module syntax, such as AMD or CommonJS, (to avoid using globals)
暂时没有。整个 html 模板机制是在模块系统流行起来之前编写的。
使用 grunt-ts
和 html: ["*.tpl.html"]
选项,它最终将 *.tpl.html
个文件编译成 *.tpl.html.js
个文件,它设置了全局 var
。
我可以告诉 grunt-ts
以不同的模块语法(例如 AMD 或 CommonJS)输出最终的 .js
文件(以避免使用全局变量)吗?
Can I instead tell grunt-ts to output the final .js file in a different module syntax, such as AMD or CommonJS, (to avoid using globals)
暂时没有。整个 html 模板机制是在模块系统流行起来之前编写的。