WebStorm 8.0.0 Web Help

Context menu of a Gruntfile.js - Open Grunt Console

View | Tool Windows | Grunt

Note

  • The tool window is available only when the following prerequisites are met:
    1. The Node.js framework is installed on your computer.
    2. The NodeJS plugin is enabled. The plugin is bundled with WebStorm and activated by default. If not, enable it as described in Enabling and Disabling Plugins.
    3. The grunt-cli package is installed globally and the grunt package is installed in the current project, see Installing Grunt for details.
    4. At least one Gruntfile.js file is available in the current project.
  • View | Tool Windows | Grunt - the tool window can be accessed this way only after you have opened it using the Open Grunt Console command.

The tool window opens when you invoke Grunt by choosing Open Grunt Console on the context menu of a Gruntfile.js in the Project tool window or of a Gruntfile.js opened in the editor. Use the tool window to run Grunt tasks and view their output.

As soon as you invoke Grunt, it starts building a tree of tasks according to the Gruntfile.js on which it was invoked. The tree is shown in the left-hand pane of the tool window. If a task has targets, the task is displayed as a node and the targets are listed under it.

The tool window consists of two panes:

Grunt Tasks Tree Pane

The pane shows a tree of Grunt tasks. The tree is built according to the Gruntfile.js on which Grunt was invoked. If a task has targets, the task is displayed as a node and the targets are listed under it.

If you have several Gruntfile.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 in a separate tab.

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

  • Select the required Gruntfile.js file in the Project tool window and choose Open Grunt Console on the context menu of the selection.
  • Open the required Gruntfile.js file in the editor and choose Open Grunt Console on the context menu of the editor.
  • If the Grunt tool window is already opened, click the Add Gruntfile button add on the toolbar and choose the required Gruntfile.js file from the pop-up list. WebStorm adds a new tab and builds a tasks tree in it.

To run a task or target, do one of the following:

  • Double click the required task/target in the tree.
  • Select the required task or target and choose Run <task name> on the context6 menu of the selection.
  • Select the required task or target and press EnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnter.
  • 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 or target, select the required task/target in the tree and choose Jump to source o the context menu of the selection.

The task or target execution output will be displayed in the right-hand, Grunt Console, pane. The name of the target is shown in the format <task name>:<target name>.

To run several tasks or targets, use the multiselect mode: hold ShiftShiftShiftShiftShiftShiftShiftShiftShiftShiftShift (for adjacent items) or CtrlCtrlCtrlCtrlCtrlCtrlCtrlCtrlCtrlCtrlCtrl   (for non-adjacent items) keys and select the required items, then choose Run on the context menu of the selection.

The result of task execution is displayed in the Grunt Console pane. The pane 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 pane.

Item Tooltip Description
add Add Gruntfile Click this button to have a tasks tree for another Gruntfile.js file built. Choose the required Gruntfile.js file from the pop-up list. WebStorm adds a new tab and builds a tasks tree in it.
refresh Reload Click this button to have the tasks tree in the selected tab 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.
tool_window_grunt_toolbar_f Set --f option
  • When this toggle button is pressed, Grunt ignores warnings and continues executing the launched task until the task is completed successfully or an error occurs.
  • When this toggle button is released, Grunt cancels task execution as soon as a warning occurs.
tool_window_grunt_toolbar_v Set --v option Press this toggle button to have the verbose mode applied and thus have a full detailed log of a task execution displayed.
close Close Click this button to close the tool window.
help Help Click this button to open the reference page for the tool window.

Grunt Console Pane

The pane 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 pane.

Toolbar
Item Tooltip Description
stop.gif Stop Ctrl+F2Ctrl+F2Ctrl+2Ctrl+F2Ctrl+F2Shift+F5Shift+F5 or Ctrl+Shift+DeleteCtrl+F2Command F2Command F2Command F2 Click this button to cancel execution of a task without closing the tool window.
arrowUp Up the stack trace
Ctrl+Alt+Up
Click this button to navigate to the previous exception.
arrowDown Down the stack trace
Ctrl+Alt+Down
Click this button to navigate to the next exception.
icon_softWrap Use Soft Wraps Click this toggle button to have the soft wrap mode applied to the output.
scrollToEnd.png Scroll to the end Click this button to navigate to the bottom of the output tab named after the last executed task.
print.png Print Click this button to have the contents of the console printed out. Upon clicking the button, WebStorm opens the Print dialog box, where you can configure the printing procedure and output.
clear_all Clear All Click this button to remove all text from the console. This function is also available on the context menu of the console.

See Also

Procedures:

External Links:

Web Resources: