我正在通过grunt建立角度应用程序,并在grunt-dom-munger面临问题
这是我的grunt文件配置设置
dom_munger: {
read: {
options: {
read: [
{
selector: 'script', // script[data-concat!="false"]
attribute: 'src',
writeto: 'appjs',
isPath: true
},
{
selector: 'link[rel="stylesheet"]', // link[rel="stylesheet"][data-concat!="false"]
attribute: 'href',
writeto: 'appcss',
isPath: true
}
]
},
src: 'app/index.html'
},
update: {
options: {
remove: ['script[data-remove!="false"]', 'link[data-remove!="false"]'],
append: [
{
selector: 'body',
html: '<script src="app.full.min.js"></script><script src="config.js"></script>'
},
{
selector: 'head',
html: '<link href="favicon.ico" rel="shortcut icon"><link rel="stylesheet" href="assets/css/app.full.min.css">'
}
]
},
src: 'app/index.html',
dest: 'dist/app/index.html'
}
},
cssmin: {
main: {
src: ['temp/app.css', '<%= dom_munger.data.appcss %>'],
dest: 'dist/app/assets/css/app.full.min.css'
}
},
concat: {
main: {
src: ['<%= dom_munger.data.appjs %>', '<%= ngtemplates.main.dest %>'],
dest: 'temp/app.full.js'
}
},
当我运行grunt build时,抛出以下警告/错误
Running "cssmin:main" (cssmin) task
Warning: An error occurred while processing a template (Cannot read property 'appcss' of undefined). Used --force, continuing.
Warning: An error occurred while processing a template (Cannot read property 'appcss' of undefined). Used --force, continuing.
Warning: An error occurred while processing a template (Cannot read property 'appcss' of undefined). Used --force, continuing.
Warning: The "path" argument must be of type string Used --force, continuing.
Running "concat:main" (concat) task
Warning: An error occurred while processing a template (Cannot read property 'appjs' of undefined). Used --force, continuing.
Warning: An error occurred while processing a template (Cannot read property 'appjs' of undefined). Used --force, continuing.
Warning: An error occurred while processing a template (Cannot read property 'appjs' of undefined). Used --force, continuing.
File temp/app.full.js created.
注意:位于/ app目录和目标文件夹中的源应用程序文件是/ dist /
任何人都可以在我犯错的地方帮助我。
答案 0 :(得分:0)
我们在构建时遇到了同样的问题。 经过大量的研发,我们找到了解决方案。 请在“ node_modules / grunt-dom-munger / tasks / dom_munger.js”文件中更改行号 42 。
prevenDefault()
收件人
<script>
// I have added only for the save function
$('#save').click(function (e) {
e.preventDefault();
$(this).hide();
$('#cancel').hide();
$('#edit').show();
$("#target :input").prop("disabled", true);
});
$("#target :input").prop("disabled", true);
</script>