Saturday, July 13, 2013

NodeJS Sublime Text Auto Start Debugger On Build

A quick awesome note. When developing in NodeJs, it is rather nice to have the nodejs automatically start again. This simple little change to helped with debugging in Sublime Text.

Edit the following file:
C:\Users\Brock\AppData\Roaming\Sublime Text 2\Packages\Nodejs\Nodejs.sublime-build
I'll leave it to the read to find it on linux.

Merge the following code into the file:
{
"cmd": ["node --debug", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.js",
"shell":true,
"encoding": "cp1252",
"windows":
{
"cmd": ["taskkill /F /IM node.exe & node --debug", "$file"]
},
"linux":
{
"cmd": ["killall node; node", "$file"]
}
}
Now every time you build, it will restart the node process with debugging enabled.

No comments: