Grunt tool window
Context menu of a Gruntfile.js - Show Grunt Tasks
View | Tool Windows | Grunt
Use this tool window to run Grunt tasks. The result of executing a task is shown in the Run tool window. The tool window shows the Grunt output, reports the errors occurred, lists the packages or plugins that have not been found, etc. The name of the last executed task is displayed on the title bar of the tool window.
Download and install Node.js.
Install the grunt-cli package (Grunt command-line interface) globally and install the grunt package as a development dependency. For more information, refer to Installing Grunt.
tip
When you build a tree of tasks for the first time during a WebStorm session, the Grunt tool window is not opened yet.
If you already opened the Grunt tool window, you can access it with Search everywhere. Press Shift twice to open the search window, start typing your query, for example,
Grunt task
, and select Show Grunt Tasks from the list.Alternatively, select View | Tool Windows | Grunt from the main menu.
Select the required Gruntfile.js file in the Project tool window Alt01 or open it in the editor and choose Show Grunt Tasks from the context menu.
In the Grunt tool window, click on the toolbar and choose the required Gruntfile.js file from the list. By default, WebStorm shows the Gruntfile.js file in the root of your project.
If you have another Gruntfile.js file, click Choose Gruntfile.js and select the Gruntfile.js file you need in the dialog that opens. WebStorm adds a new node with the path to the chosen Gruntfile.js file on its title and builds a tasks tree under the new node.
Switch to the required node and click on the toolbar.
Click on the toolbar, choose Sort by from the menu, and then choose Name.
By default, a tree shows the tasks in the order in which they are defined in Gruntfile.js (option Definition order).
Double-click the task or target.
Select the task or target in the tree and press Enter or choose Run <task name> from the context menu.
Select the root node in the tree, and choose Run default on the context menu of the selection.
Use the multiselect mode: hold Shift (for adjacent items) or Ctrl (for non-adjacent items) keys and select the required tasks or targets, then choose Run or Debug from the context menu of the selection.
Select the required task or target in the tree, and choose Jump to source from the context menu of the selection.
Add Gruntfile | Click this button to have a task tree for another Gruntfile.js file built. Choose the required Gruntfile.js file from the list. WebStorm adds a new node and builds a task tree under it. | |
Remove Gruntfile | Click this button to remove the task tree under the selected node. | |
Reload tasks | Click this button to have the task tree under the selected node re-built. You may need a tree re-built after updating the corresponding Gruntfile.js file because Grunt does not apply changes to trees on the fly. | |
Collapse all | Click this button to hide all the tasks trees and have only Gruntfile.js nodes displayed. | |
Click this button to configure the current view and to change the viewing modes of the tool window . For more information, refer to Tool window view modes. 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 Grunt-specific options are:
| ||
Hide | Click this button to hide the tool window. To have it displayed again, select View | Tool Windows | Grunt in the main menu. The tool window appears again showing all the previously built trees of tasks. |
Grunt Settings | Choose this menu item to open the Grunt Settings dialog and view or edit the Node.js configuration |
Jump to Source | Choose this menu item to open the Gruntfile.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 Gruntfile.js file according to which the current tree was built to the clipboard. |
Remove Gruntfile.js | Choose this menu item to remove the tree of tasks under the selected node. |
Run <task/target name> | Choose this menu item to run the selected task or target. |
Debug <task/target name> | Choose this menu item to debug the selected task or target. |
Edit <task/target name> settings | Choose this menu item to open the Run/Debug Configuration dialog and edit the predefined settings for the selected task or target. |
Jump to Source | Choose this menu item to open the Gruntfile.js file for which the current tree is built and navigate to the definition of the selected task or target. |
Thanks for your feedback!