WebStorm -> how to execute JavaScript in PhantomJS?

Hi,

I want to excute my JavaScript with PhantomJS, but I can't figure out how to configure that.
I also didn't find a plugin for running .js files in PhantomJS.

So my question is easy: How do I configure WebStorm to execute certain .js files in PhantomJS?
(This is currently for mac, but that should work on Win too).

Regards,

   Sebastian

8 comments
Comment actions Permalink

Hi Sebastian,

I would suggest you to set up an external tool:
externaltool.png
Done that, just trigger main menu action (you can assign keyboard shortcut to it) and it will execute the file in the active editor tab:
               mainmenu.png

Regards,
Kirill

0
Comment actions Permalink

Works like a charm. Thank you :)

0
Comment actions Permalink

Wow. That's great ! Thank you Kirill Safonov :) !

0
Comment actions Permalink

Hey, I need some help.

My windows user account has a whitespace in it's name. Webstorm gives me the following error: "Can't open 'C:\Users\Name'

How do I solve this problem?

 

Thanks in advance.

0
Comment actions Permalink

Is it about external tools? what does the tool definition look like? Please attach a screenshot

1
Comment actions Permalink

Yes, it is the same tool (PhantomJS)

Results in:

 

0
Comment actions Permalink

1. don't add quotes around Program: path - WebStorm will take care of it

2. as you are using $FileDir$ as a working directory, you can just use $FileName$ as Arguments:; but, if you like to pass a full path, use "$FileDir$/$FileName$" (in quotes)

1
Comment actions Permalink

Thanks for your help. Now it works :)

1

Please sign in to leave a comment.