如何仅使用task.json链接Visual Studio Code中的任务? [英] How to chain tasks in Visual Studio Code using only tasks.json?

查看:106
本文介绍了如何仅使用task.json链接Visual Studio Code中的任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究 Visual Studio代码的文档,以了解如何将多个连续的任务添加到tasks.json文件.

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.

tasks数组仅允许为同一命令创建不同的参数.在此示例中,命令为echo.

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"]
        }
    ]
}

tasks.json是否允许多个任务连续执行?例如,tsc后跟uglify?

Does tasks.json allow several tasks to be executed consecutively? For example, tsc followed by uglify?

推荐答案

dependsOn功能已在

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": []
        }
    ]
}

这篇关于如何仅使用task.json链接Visual Studio Code中的任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆