This is my task.json
// A task runner configuration for gulp. Gulp provides a less task // which compiles less to css. { "version": "0.1.0", "command": "gulp", "isShellCommand": true, "tasks": [ { "taskName": "sfdcBuild", // Make this the default build command. "isBuildCommand": true, // Show the output window only if unrecognized errors occur. "showOutput": "always", // Use the standard less compilation problem matcher. "problemMatcher": "$lessCompile" } ] }
Unfortunately my gulp installation (the local one) is not under root but inside another folder:
root/js/
so how can I define that I would like to run this gulp command from inside the other folder?
PS: moving the task.json into the subfolder did nor work.
Run a Gulp Task in Visual Studio CodeType "Run Task" and select it, which will bring up a list of tasks configured in Gulp. Choose the Gulp Task you want to run! Most of your Gulp Tasks will probably be automated using gulp watch, but manual Gulp Tasks can easily be run within Visual Studio Code.
To do this, right click project > Add New Item.. Select Web node and select npm Configuration file and click Add. Next, we will create gulp tasks to minimize html and javascript files in our solution. To do this, we need to install gulp-htmlclean and gulp-uglify plugins from command prompt using the below commands.
Tip: You can run your task through Quick Open (Ctrl+P) by typing 'task', Space and the command name. In this case, 'task lint'.
You can go to that specific directory or create shortcut to desktop then click right click on that folder and then click on open with code. If you didnot see open with code then reinstall your VS code and check on open with code when you are reinstalling VS Code.
Using a different working directory is partly supported. It doesn't work for auto detection of gulp tasks but it should work for running gulp. You can add something like this to the tasks.json in the top level scope
"options": { "cwd": "${workspaceRoot}/mySubDir" },
However this still assumes that gulp and all node modules guld requires are accessible from that directory.
The tasks.json doesn't support at this time launching a task with a different cwd
. One way to workaround it would be to create a gulp.cmd
or gulp.sh
file in your workspace's root folder that invokes the correct gulp
. E.g. gulp.cmd
:
@SETLOCAL @SET PATHEXT=%PATHEXT:;.JS;=;% node "%~dp0\node_modules\gulp\bin\gulp.js" %*
To avoid committing this to your git repository, you could ignore it in .git/info/exclude
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