我已经配置了咕噜-控制连接,但是服务器没有继续运行:
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'
]);
});当运行任务" server“时,服务器启动和停止,忽略以下选项:
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发布于 2014-11-22 21:30:12
在您的第一个示例中,您的配置只是没有目标,在您的第二个示例中,它有一个目标"abc“。
添加目标可能有效,我认为目标甚至可能是空的!:
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
options: {
port: 9000,
base: 'src/main/webapp',
keepalive: true
},
abc: {}
}
});https://stackoverflow.com/questions/27056330
复制相似问题