Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自定义函数预编译后的文件里面没了 #6

Open
tianzhiqing opened this issue Aug 10, 2014 · 3 comments
Open

自定义函数预编译后的文件里面没了 #6

tianzhiqing opened this issue Aug 10, 2014 · 3 comments

Comments

@tianzhiqing
Copy link

我还只做一个demo,代码如下
index.html


aa{{tag}}

cc{{time | dateFormat:'yyyy年 MM月 dd日 hh:mm:ss'}}


预编译后
index.js
template('confirmOrder/index',function($data,$id) {
var $helpers=this,$escape=$helpers.$escape,tag=$data.tag,$out='';$out+='
aa';
$out+=$escape(tag);
$out+='
cc
';
return new String($out);
});
貌似那个函数被干掉了

@piaoluoya
Copy link

我也遇到这个问题了,你怎么解决的?

@tianzhiqing
Copy link
Author

@piaoluoya
##我的解决办法是没有用这grunt-tmodjs脚本,具体实现如下
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']);

@piaoluoya
Copy link

谢谢了,我的问题也是没有用grunt-tmodjs 才解决的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants