I have been ploughing through the documentation of Visual Studio Code to figure out how to add multiple consecutive tasks to the tasks.json
file.
The tasks
array only allows for creating different arguments to the same command. In this example the command is echo
.
{ "version": "0.1.0", "command": "echo", "isShellCommand": true, "args": [], "showOutput": "always", "echoCommand": true, "suppressTaskName": true, "tasks": [ { "taskName": "hello", "args": ["Hello World"] }, { "taskName": "bye", "args": ["Good Bye"] } ] }
Does tasks.json allow several tasks to be executed consecutively? For example, tsc
followed by uglify
?
Note that the definition is a list, so more than one task can be specified. In that case the tasks are executed in parallel. In your case adding "dependsOn":["Compile/minify cms. scss"] to your main build task should execute both tasks.
tasks. json is used to execute anything else you may want, be that source code formatters, bundlers or a SASS compiler. To use a configuration from tasks. json , you select Run Task from the command list.
Double-clicking a TODO in the tree will open the file and put the cursor on the line containing the task. In open files, TODOs can also be highlighted for easier navigation. You can further customize the extension by specifying specific flags in VSCode settings, more details can be found at TODO Tree wiki page.
The dependsOn
feature was shipped in version 1.10.0. For example, I am using this to compile and run single file scripts in TypeScript:
{ "version": "2.0.0", "tasks": [ { "command": "tsc -p ${cwd}/2017-play", "label": "tsc-compile", "type": "shell" }, { "command": "node ${cwd}/2017-play/build/${fileBasenameNoExtension}.js", "label": "node-exec", "type": "shell", "dependsOn": [ "tsc-compile" ], "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