[英]grunt-contrib-connect ignores task options
我已经配置了grunt-contrib-connect,但是服务器没有保持活动状态:
的package.json
{
"name": "my-project-name",
"version": "0.1.0",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-connect": "^0.9.0",
}
}
Grundfilesnippet:
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
options: {
port: 9000,
base: 'src/main/webapp',
keepalive: 'true'
}
}
});
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.registerTask('server', function () {
grunt.task.run([
'connect'
]);
});
运行任务“服务器”时,服务器将启动和停止,并忽略以下选项:
Running "server" task
Done, without errors.
但是像这样更改配置:
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
abc:{
options: {
port: 9000,
base: 'src/main/webapp',
keepalive: 'true'
}
}
}
});
使任务运行“ connect:abc”并接受选项。 为什么忽略任务默认选项?
Running "server" task
Running "connect:abc" (connect) task
Waiting forever...
Started connect web server on http://0.0.0.0:9000
在第一个示例中,您的配置仅没有目标 ,在第二个示例中,其目标是“ abc”。
添加一个目标应该可以工作,我认为目标甚至可能是空的!:
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
options: {
port: 9000,
base: 'src/main/webapp',
keepalive: true
},
abc: {}
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.