簡體   English   中英

如何使用task.json版本2配置gulp構建?

[英]How to configure gulp build with tasks.json version 2?

現在,我們在Visual Studio Code中使用task.json 0.1.0版本的任務。

導航到https://code.visualstudio.com/docs/editor/tasks表示VS代碼將自動檢測我的gulp文件中的所有任務。

我已經安裝了各種擴展程序來嘗試自動檢測我的任務,但仍未被檢測到。

在這一點上,我正在考慮創建一個新版本的task.json來處理我們所有的任務。

我該怎么做呢? 這是我的task.json 0.1.0:

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "gulp",
"isShellCommand": true,
"args": [],
"showOutput": "always",
"options": {
    "cwd": "${workspaceRoot}/MyAppName"
},
"tasks": [
    {
        "taskName": "build",
        "args": ["build:debug"]
    },
    {
        "taskName": "build:debug",
        "args": ["build:debug"]
    },
    {
        "taskName": "build:release",
        "args": ["build:release"]
    }
]
}

我已經看過其他問題,目前似乎沒有任何跡象表明如何在task.json 2.0中運行gulp。

我希望能夠從包含gulpfile的文件夾外部使用此構建任務。 我知道如果打開gulpfile的文件夾,VS會自動檢測任務。

在網上搜索后,我什么都找不到。 我想為我們的build:debug gulp任務設置代碼中的自定義構建。

因此,我建立了自己的:

(buildDebug.sh)

#!/bin/bash
clear
pwd
cd [your gulpfile.js directory]
gulp build:debug

(tasks.json)

    {
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "taskName": "Run Build",
            "type": "shell",
            "command": "/c/[where you saved buildDebug.sh]/buildDebug.sh",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "presentation": {
                "reveal": "always",
                "panel": "shared"
            }
        }
    ]
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM