telekommander
4/13/2017 - 8:22 AM

VSCode run multiple build task

VSCode run multiple build task

// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
// **************************************************
// USING:
// npm installĂ‚ node-sass -g
// npm install uglify-js -g
// npm install html-minifier -g
// **************************************************
{
    "version": "2.0.0",
    "tasks": [
        {
            "taskName":         "css-default",
            "command":          "node-sass",
            "isShellCommand":   true,
            "args":             ["${file}", "${fileDirname}/${fileBasenameNoExtension}.css", "--output-style=expanded", "--sourceMap=${fileDirname}"],
            "showOutput":       "silent"
        },
        {
            "taskName":         "css-minify",
            "command":          "node-sass",
            "isShellCommand":   true,
            "args":             ["${file}", "${fileDirname}/${fileBasenameNoExtension}.min.css", "--output-style=compressed", "--sourceMap=${fileDirname}"],
            "showOutput":       "silent"
        },
        {
            "taskName":         "js-minify",
            "command":          "uglifyjs",
            "isShellCommand":   true,
            "args":             ["${file}", "--compress", "--mangle", "--quotes 1", "--comments all", "--output ${fileDirname}/${fileBasenameNoExtension}.min.js", "--source-map ${fileDirname}/${file}.map"],    
            "showOutput":       "silent"
        },        
        {
            "taskName":         "build", // THE BUILD TASK
            "isBuildCommand":   true,    // THIS KEY IDENTIFIES THE VSCODE BUILD TASK, RUN USING F1 => TASK BUILD
            "dependsOn":        ["css-default", "css-minify", "js-minify"] // THE MAGIC TO RUN MULTIPLE BUILD TASK BY TASKNAME
        },
        {
            "taskName":         "Example Terminal Output",
            "command":          "echo",
            "isShellCommand":   true,
            "args":             ["HelloWorld"],
            "showOutput":       "always"
        }
    ]
}