这是我的Gruntfile.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']);
};
答案 0 :(得分:2)
你忘了在返回数组中写昏迷
return [
function(req, res, next) {
res.setHeader('X-UA-Compatible', 'IE-edge');
next();
},
connect.static('project')
]