Automatic Grunt Watch in ConEmu Split Tab

After many years of playing with alternative consoles for Windows, I had settled on Console 2 for most of my Node.js and general Windows tasks, and the Cygwin port of Bash for my Git, SSH, and VM-related tasks. Recently though I was introduced to ConEmu, and it has quickly become my favorite.

ConEmu will run any shell that you have installed, and adds features that makes using those shells much more efficient and fun to use than if you were to run them independently.

If you’re using Node.js as part of your Web development workflow, chances are that you’re taking advantage of a task runner like Grunt or Gulp to automate certain tasks, e.g. concatenation, minification, and linting. I’m going to share how to create a task in ConEmu that will automatically split your view in half, create a new console on the right side, and then run grunt watch in that new console from your current directory.

Running Grunt Watch in a Split ConEmu Tab

ConEmu Task Settings for Grunt Watch

Setting up this task is incredibly simple:
Grunt Watch Task Settings in ConEmu

  1. Hit Win + Alt + P to bring up the ConEmu Settings window
  2. Select Tasks under the Startup menu
  3. Create a new task by clicking the + button
  4. Give this new task a name, like Scripts::Grunt Watch
  5. For Task parameters, enter /dir %cd% so that the new console is started in the same directory as your current console
  6. In the Commands box, enter cmd.exe /k "%ConEmuBaseDir%\CmdInit.cmd" -cur_console:sH & grunt watch
  7. Hit Save settings

It is as simple as that. If you are having any trouble, click on the screenshot of the settings above to view it at full size and verify what you entered.

Now you can simply open ConEmu, cd to the root directory of your project, and run this new task. What you’ll have is your primary console for running commands manually on the left, and a console running grunt watch on the right, allowing you to keep an eye on all of your automated tasks while you continue to work.

About: Kurt Maine

Kurt Maine is a Full-Stack Web Developer and an early adopter of Node.js whose professional experience has spanned several languages and frameworks, namely Ruby on Rails, C#/VB.NET and the Symfony and Laravel PHP frameworks.


Leave a Reply

Your email address will not be published. Required fields are marked *