Running grunt job with target / argument in VSCode

I have VSCode version 1.18.1 and this is in my Gruntfile.js

 grunt.registerTask('release', 'Release process', function(target) { ... } 

target exists so i can run grunt release:one or grunt release:two . However, I cannot figure out how to get VSCode to run the task using one|two target.

This is a tasks.json VSCode file created with automatic detection of a Grunt task.

 { // 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 in the task attribute of the tasks.json file, VSCode will complain about something like

 Error: The grunt task detection didn't contribute a task for the following configuration: 

Has anyone done something like this? Could you advise me how to do this?

Thanks!

+5
source share
1 answer

As I myself solved this problem, I created a task of the shell type instead and entered the full command. For example, you can do the 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": [], } ] }

0
source

Source: https://habr.com/ru/post/1273527/


All Articles