I have VSCode version 1.18.1, and this in my Gruntfile.js
grunt.registerTask('release', 'Release process', function(target) {
...
}
The target
is there so that I can run grunt release:one
or grunt release:two
. However, I can't figure out how to make VSCode run the task with the one|two
target.
This is tasks.json
file VSCode created with Grunt task auto detected.
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "grunt",
"task": "release",
"problemMatcher": [],
"label": "Release Process",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
If I put release:one
to the task
attribute of the tasks.json
file, VSCode will complain with something like
Error: The grunt task detection didn't contribute a task for the following configuration:
Anyone has done something similar to this? Can you please guide me on how to do it?
Thank you!
The Grunt option API is for sharing parameters across multiple tasks and accessing parameters set on the command line. An example would be a flag to target whether your build is for development or staging. On the command line: grunt deploy --target=staging would cause grunt. option('target') to return "staging" .
The way I solved this issue myself was by creating a Task of type shell
instead, and putting in the full command. For example, you can do following:
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "Release one",
"command": "grunt release:one",
"problemMatcher": [],
}, {
"type": "shell",
"label": "Release two",
"command": "grunt release:two",
"problemMatcher": [],
}
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With