Angularjs 警告:任务“;“违约”;找不到
这是我的Angularjs 警告:任务“;“违约”;找不到,angularjs,gruntjs,gruntfile,Angularjs,Gruntjs,Gruntfile,这是我的grunfile.js module.exports = function(grunt) { require('logfile-grunt')(grunt, { filePath: './logs/grunt.log', clearlogFile: true }); grunt.initConfig({ // pkg: grunt.file.readJSON('package.json'), connect: { server: {
grunfile.js
module.exports = function(grunt) {
require('logfile-grunt')(grunt, {
filePath: './logs/grunt.log',
clearlogFile: true
});
grunt.initConfig({
// pkg: grunt.file.readJSON('package.json'),
connect: {
server: {
options: {
port: 9001,
hostname: '*',
middleware: function(connect, options) {
return [
function(req, res, next) {
res.setHeader('X-UA-Compatible', 'IE-edge');
next();
}
connect.static('project')
]
}
}
}
},
watch: {
options: {
livereload: true
},
files: ['project/**/*.js', 'project/**/*.html', 'project/**/*.css'],
task: []
}
});
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['connect:server', 'watch']);
};
您忘记在返回数组中写入coma
return [
function(req, res, next) {
res.setHeader('X-UA-Compatible', 'IE-edge');
next();
},
connect.static('project')
]
我知道这与您的答案不太一致,但还有一些其他捆绑包/任务运行程序与angular一起工作,使开发服务器和env的方式比grunt或gulp更易于使用。例如网页包装或浏览。