Chomper Stomping jQuery/JavaScript/CSS 3/HTML 5, Java/PHP/Python/ActionScript, Git, Chrome/Firefox Extensions, Wordpress/Game/iPhone App Development and other random techie tidbits I've collected

26Jul/123

Sublime Text 2 Grunt Build

Kick off a grunt build from within Sublime Text 2:

{
"cmd": ["grunt"],
"working_dir": "/Users/[your username]/[your project path]",
"shell": true
}

It took me a bit to figure out how to actually make a grunt build run from within SublimeText 2, so I wanted to capture it here for anyone else trying to figure it out. Google really didn't help me at all...

The key is the working directory thing. You can't use "~/", you have to actually use the full path to your directory that you normally kick your grunt builds off from. I found one place on stackoverflow where it recommended adding this after "grunt":

, "--no-color"

but it didn't change the output for me at all.

You put this code in a file you create by clicking "tools" > "build system" > "new build system". Then whatever you name the file when you save it will be the name of the "build system". You can hit "cmd B" to build it or select "tools" > "build system" > "whatever you named it"

Comments (3) Trackbacks (0)
  1. Hello, thanks for the tip …

    but it only show a partial of the grunt output … so i dont know if the build succeed or failed.

    for example I see:
    Running “lint:files” (lint) task
    [Finished in 0.6s]

    but in the command line I see:
    Running “lint:files” (lint) task
    Linting src/x.js…ERROR
    [L1:C1] ‘define’ is not defined…

    Any idea?

  2. The substitution parameter for the project might save you having to bind the build settings to a specific location

    “working_dir”: “${project_path},


Leave a comment

No trackbacks yet.