admin管理员组文章数量:1022989
I have a very simple grunt setup. The only active plugin is grunt-contrib-connect. Here is my package.json file:
{
"name": "gruntApp",
"version": "0.1.0",
"description": "An application for testing Grunt.js",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-connect": "~0.3.0"
}
}
My gruntfile looks like this:
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
log:
start: 'Grunt is starting for application <%=pkg.name%> v<%=pkg.version%>'
end: 'Grunt is finishing'
grunt.registerMultiTask 'log', ->
grunt.log.writeln this.data
grunt.registerTask 'printConfig', ->
grunt.log.writeln JSON.stringify grunt.config(), null, 2
grunt.loadNpmTasks 'grunt-contrib-connect'
grunt.registerTask 'default', [
'log:start'
'log:end'
]
My custom tasks work, but grunt connect
does not. Here is the output at the console:
$ grunt connect -v
Initializing
Command-line options: --verbose
Reading "Gruntfile.coffee" Gruntfile...OK
Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK
Registering "grunt-contrib-connect" local Npm module tasks.
Reading /Users/eric/Projects/gruntApp/node_modules/grunt-contrib-connect/package.json...OK
Parsing /Users/eric/Projects/gruntApp/node_modules/grunt-contrib-connect/package.json...OK
Loading "connect.js" tasks...OK
+ connect
Loading "Gruntfile.coffee" tasks...OK
+ default, log, printConfig
Running tasks: connect
Running "connect" task
>> No "connect" targets found.
Warning: Task "connect" failed. Use --force to continue.
Aborted due to warnings.
What up with that, yo? It looks like it detects the connect task, but later it can't find the target. What am I missing? I was following the directions from here:
I have a very simple grunt setup. The only active plugin is grunt-contrib-connect. Here is my package.json file:
{
"name": "gruntApp",
"version": "0.1.0",
"description": "An application for testing Grunt.js",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-connect": "~0.3.0"
}
}
My gruntfile looks like this:
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
log:
start: 'Grunt is starting for application <%=pkg.name%> v<%=pkg.version%>'
end: 'Grunt is finishing'
grunt.registerMultiTask 'log', ->
grunt.log.writeln this.data
grunt.registerTask 'printConfig', ->
grunt.log.writeln JSON.stringify grunt.config(), null, 2
grunt.loadNpmTasks 'grunt-contrib-connect'
grunt.registerTask 'default', [
'log:start'
'log:end'
]
My custom tasks work, but grunt connect
does not. Here is the output at the console:
$ grunt connect -v
Initializing
Command-line options: --verbose
Reading "Gruntfile.coffee" Gruntfile...OK
Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK
Registering "grunt-contrib-connect" local Npm module tasks.
Reading /Users/eric/Projects/gruntApp/node_modules/grunt-contrib-connect/package.json...OK
Parsing /Users/eric/Projects/gruntApp/node_modules/grunt-contrib-connect/package.json...OK
Loading "connect.js" tasks...OK
+ connect
Loading "Gruntfile.coffee" tasks...OK
+ default, log, printConfig
Running tasks: connect
Running "connect" task
>> No "connect" targets found.
Warning: Task "connect" failed. Use --force to continue.
Aborted due to warnings.
What up with that, yo? It looks like it detects the connect task, but later it can't find the target. What am I missing? I was following the directions from here: https://github./gruntjs/grunt-contrib-connect#getting-started
Share Improve this question edited Dec 24, 2013 at 22:41 SimplGy asked Apr 24, 2013 at 16:56 SimplGySimplGy 20.4k15 gold badges111 silver badges150 bronze badges 2-
The only targets I see are
pkg
andlog
. There is noconnect
target. Have a look at github./gruntjs/grunt-contrib-connect#usage-examples. – Felix Kling Commented Apr 24, 2013 at 17:05 -
I thought that using
grunt.loadNpmTasks 'grunt-contrib-connect'
would load the targets and tasks from that module. Not so, I see that adding the targetconnect
to initConfig solves the issue. – SimplGy Commented Apr 24, 2013 at 17:09
1 Answer
Reset to default 5Configuring the task + target is an important part of making it available from the mand line. To make grunt connect work
, add configuration to .initConfig
:
grunt.initConfig
connect:
server:
options:
base: 'app'
keepalive: true
I have a very simple grunt setup. The only active plugin is grunt-contrib-connect. Here is my package.json file:
{
"name": "gruntApp",
"version": "0.1.0",
"description": "An application for testing Grunt.js",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-connect": "~0.3.0"
}
}
My gruntfile looks like this:
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
log:
start: 'Grunt is starting for application <%=pkg.name%> v<%=pkg.version%>'
end: 'Grunt is finishing'
grunt.registerMultiTask 'log', ->
grunt.log.writeln this.data
grunt.registerTask 'printConfig', ->
grunt.log.writeln JSON.stringify grunt.config(), null, 2
grunt.loadNpmTasks 'grunt-contrib-connect'
grunt.registerTask 'default', [
'log:start'
'log:end'
]
My custom tasks work, but grunt connect
does not. Here is the output at the console:
$ grunt connect -v
Initializing
Command-line options: --verbose
Reading "Gruntfile.coffee" Gruntfile...OK
Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK
Registering "grunt-contrib-connect" local Npm module tasks.
Reading /Users/eric/Projects/gruntApp/node_modules/grunt-contrib-connect/package.json...OK
Parsing /Users/eric/Projects/gruntApp/node_modules/grunt-contrib-connect/package.json...OK
Loading "connect.js" tasks...OK
+ connect
Loading "Gruntfile.coffee" tasks...OK
+ default, log, printConfig
Running tasks: connect
Running "connect" task
>> No "connect" targets found.
Warning: Task "connect" failed. Use --force to continue.
Aborted due to warnings.
What up with that, yo? It looks like it detects the connect task, but later it can't find the target. What am I missing? I was following the directions from here:
I have a very simple grunt setup. The only active plugin is grunt-contrib-connect. Here is my package.json file:
{
"name": "gruntApp",
"version": "0.1.0",
"description": "An application for testing Grunt.js",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-connect": "~0.3.0"
}
}
My gruntfile looks like this:
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
log:
start: 'Grunt is starting for application <%=pkg.name%> v<%=pkg.version%>'
end: 'Grunt is finishing'
grunt.registerMultiTask 'log', ->
grunt.log.writeln this.data
grunt.registerTask 'printConfig', ->
grunt.log.writeln JSON.stringify grunt.config(), null, 2
grunt.loadNpmTasks 'grunt-contrib-connect'
grunt.registerTask 'default', [
'log:start'
'log:end'
]
My custom tasks work, but grunt connect
does not. Here is the output at the console:
$ grunt connect -v
Initializing
Command-line options: --verbose
Reading "Gruntfile.coffee" Gruntfile...OK
Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK
Registering "grunt-contrib-connect" local Npm module tasks.
Reading /Users/eric/Projects/gruntApp/node_modules/grunt-contrib-connect/package.json...OK
Parsing /Users/eric/Projects/gruntApp/node_modules/grunt-contrib-connect/package.json...OK
Loading "connect.js" tasks...OK
+ connect
Loading "Gruntfile.coffee" tasks...OK
+ default, log, printConfig
Running tasks: connect
Running "connect" task
>> No "connect" targets found.
Warning: Task "connect" failed. Use --force to continue.
Aborted due to warnings.
What up with that, yo? It looks like it detects the connect task, but later it can't find the target. What am I missing? I was following the directions from here: https://github./gruntjs/grunt-contrib-connect#getting-started
Share Improve this question edited Dec 24, 2013 at 22:41 SimplGy asked Apr 24, 2013 at 16:56 SimplGySimplGy 20.4k15 gold badges111 silver badges150 bronze badges 2-
The only targets I see are
pkg
andlog
. There is noconnect
target. Have a look at github./gruntjs/grunt-contrib-connect#usage-examples. – Felix Kling Commented Apr 24, 2013 at 17:05 -
I thought that using
grunt.loadNpmTasks 'grunt-contrib-connect'
would load the targets and tasks from that module. Not so, I see that adding the targetconnect
to initConfig solves the issue. – SimplGy Commented Apr 24, 2013 at 17:09
1 Answer
Reset to default 5Configuring the task + target is an important part of making it available from the mand line. To make grunt connect work
, add configuration to .initConfig
:
grunt.initConfig
connect:
server:
options:
base: 'app'
keepalive: true
本文标签: javascriptWhy doesn39t gruntcontribconnect find the connect taskStack Overflow
版权声明:本文标题:javascript - Why doesn't grunt-contrib-connect find the connect task? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745536373a2154979.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论