Skip to main content

Run Node.js Express Application from TextMate

I tried a lot of existing solutions but I could not use one, so I created a new script for it.

Setup

Open Textmate > Preferences > Advanced > Shell Variables and add your node path to the PATH variable (with homebrew append :/usr/local/bin).

Now, let’s create a new command. Open Bundles > Bundle Editor > Edit Commands and create a New Bundle (name it whatever you want; I named it JavaScript With Node). Create a new command under your new bundle (name of my command is Run With Node) with the following code:

Parameters

Save: Current File
Input: Entire Document
Output: Show as HTML

Optional

Activation: Key Equivalent with ⌘R (Command + R)
Scope Selector: source.js

Additional

If you don’t want to create a script for one file (instead of the entire Express application) then use this code (e.g. Run File With Node):

Related Posts:

Balazs Nadasdi

Developer, Project Manager, Blogger, Dad... or sometihng like these