Open tianzhiqing opened 10 years ago
我也遇到这个问题了,你怎么解决的?
@piaoluoya
1、 安装tmodJS npm install -g tmodjs
2、grunt里引入安装 grunt-shell 模块,再通过shell脚本的方式调用tomodjs,具体代码如下
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
shell: {
options: {
stdout: true
},
watchXtpl: {
command: 'tmod ./src/mods --output ./src/tpl'
},
buildXtpl: {
command: 'tmod ./src/mods --output ./src/tpl --no-watch'
}
}
})
grunt.loadNpmTasks('grunt-shell');
grunt.registerTask('tpl', ['shell:watchXtpl']);
谢谢了,我的问题也是没有用grunt-tmodjs 才解决的。
我还只做一个demo,代码如下
index.html
预编译后 index.js template('confirmOrder/index',function($data,$id) { var $helpers=this,$escape=$helpers.$escape,tag=$data.tag,$out='';$out+='