WebStorm 2018.1 Help

Gulp Tool Window

On this page:

Accessing the Gulp Tool Window

Context menu of a Gulpfile.js - Show Gulp Tasks
View | Tool Windows | Gulp - the tool window can be accessed this way only after you have opened it using the Show Gulp Tasks command or after you have run tasks through the Gulp.js run configuration.

The tool window is available only when:

  1. Node.js is installed on your computer.
  2. The NodeJS plugin is enabled. The plugin is activated by default. If the plugin is disabled, enable it on the Plugins settings page as described in Enabling and Disabling Plugins.
  3. The gulp package is installed in the current project, see Installing Gulp for details.
  4. At least one Gulpfile.js file is available in the current project.

The tool window opens when you invoke Gulp.js by choosing Show Gulp Tasks on the context menu of a Gulpfile.js in the Project tool window or of a Gulpfile.js opened in the editor. The tree is built according to the Gulpfile.js file on which Gulp.js was invoked. If you have several Gulpfile.js files in your project, you can build a separate tasks tree for each of them and run tasks without abandoning the previously built tasks trees. Each tree is shown under a separate node.

If you have several Gulpfile.js files in your project, you can build a separate tasks tree for each of them and run tasks without dropping the previously built tasks trees. Each tree is shown under a separate node.

Building a Tree of Gulp Tasks

To build a tree of tasks, do one of the following:

  • Select the required Gulpfile.js file in the Project tool window or open it in the editor and choose Show Gulp tasks on the context menu.
  • In the Gulp tool window, add_black.png on the toolbar and choose the required Gulpfile.js file from the list. By default, WebStorm shows the Gulpfile.js file in the root of your project. If you have another Gulpfile.js file, click Choose Gulpfile.js and select the Gulpfile.js file you need in the dialog that opens. WebStorm adds a new node with the path to the chosen Gulpfile.js file on its title and builds a tasks tree under the new node.

To sort the tasks in a tree by their names
Click viewMode.png on the toolbar, choose Sort by on the menu, and then choose Name.
By default, a tree shows the tasks in the order in which they are defined in Gulpfile.js (option Definition order).

Running Gulp Tasks

To run a task

  • Double click the task.
  • Select the task in the tree and press Enter or choose Run <task name> on the context menu.

To run the default task
Select the root node in the tree, and choose Run default on the context menu of the selection.

To navigate to the definition of a task
Select the required task in the tree, and choose Jump to source on the context menu of the selection.

To run several tasks
Use the multiselect mode: hold Shift (for adjacent items) or Ctrl (for non-adjacent items) keys and select the required tasks, then choose Run or Debug on the context menu of the selection.

The task execution output will be displayed in the Run tool window.

Toolbar

ItemTooltipDescription
add_black Add Gulpfile Click this button to have a tasks tree for another Gulpfile.js file built. Choose the required Gulpfile.js file from the pop-up list. WebStorm builds a tasks tree and shows it under a separate node.
minusSign.png Remove Gulpfile Click this button to remove the tasks tree under the selected node.
icon_reload_grunt.png Reload tasks Click this button to have the tasks tree under the selected node re-built. You may need a tree re-built after updating the corresponding Gulpfile.js file because Gulp.js does not apply changes to trees on the fly.
icon_collapse_all_on_title_bar.png Collapse all Click this button to hide all the tasks trees and have only Gulpfile.js nodes displayed.
viewMode.png Click this button to configure the current view and to change the viewing modes of the tool window, see Tool Windows Viewing Modes for details. Note that most of the menu items are options that you can turn on or off. An option which is on has a check mark to the left of its name. The Gulp-specific options are:
  • Gulp Settings: choose this menu item to open the Gulp Settings dialog and re-configure the current settings for Gulp and for the Node interpreter, see task runner.
  • Sort by: choose this menu item to configure the order in which tasks are shown in trees. Click viewMode.png on the toolbar, choose Sort by on the menu, and then choose Name.
    By default, a tree shows the tasks in the order in which they are defined in Gulpfile.js (option Definition order).
hideSide.png Hide Click this button to hide the tool window. To have it displayed again, choose View | Tool Windows | Gulp on the main menu. The tool window appears again showing all the previously built trees of tasks.

Context Menu of a Tree

ItemDescription
Gulp Settings Choose this menu item to open the Gulp Settings dialog box and view or edit the Node.js configuration
Jump to Source Choose this menu item to open the Gulpfile.js file for which the current tree is built.
Reload tasks Choose this menu item to have the tree of tasks under the selected node re-built.
Copy Path Choose this menu item to save the path to the Gulpfile.js file according to which the current tree was built to the clipboard.
Remove Gulpfile.js Choose this menu item to remove the tree of tasks under the selected node.

Context Menu of a Task or a Target

ItemDescription
Run <task name> Choose this menu item to run the selected task.
Debug <task name> Choose this menu item to debug the selected task.
Edit <task name> settings Choose this menu item to open the Run/Debug Configuration dialog box and edit the predefined settings for the selected task.
Jump to Source Choose this menu item to open the Gulpfile.js file for which the current tree is built and navigate to the definition of the selected task.
Last modified: 20 July 2018

See Also