使用sublime text 2和3调试node-webkit

本文摘自PHP中文网,作者藏色散人,侵删。

下面由sublime使用教程栏目给大家介绍sublime text 2和3调试node-webkit的方法,希望对需要的朋友有所帮助!

使用sublime text 2和3调试node-webkit

sublime text 2是非常优秀的跨平台编辑器用于开发node-webkit应用。

Mac OS X

1.下载node-webkit.app并放在/Application文件夹内

2.从sublime text 2菜单选择Tools -> Build System -> New Build System

3.输入以下代码:

1

2

3

4

5

{

"cmd": ["node-webkit","--enable-logging","${project_path:${file_path}}"],

"working_dir":"${project_path:${file_path}}",

"path":"/Applications/node-webkit.app/Contents/MacOS/"

}

1.使用sublime text 2的File -> New Window打开一个新的窗口

2.使用Project -> Add Folder to Project添加一个工程到当前窗口中

3.从左侧的菜单中打开你的主应用程序文件(例如:index.html)然后选择Tools -> Build

4.此时node-webkit应用程序将会启动你的项目并且可以在sublime text2中看到调试输出

在sublime text3中使用方法一样。

Windows

同上面一样,不同的是建立系统的命令,如下所示(替换掉nw.exe的实际路径):

1

2

3

4

5

6

{

"cmd": ["nw.exe","--enable-logging","${project_path:${file_path}}"],

"working_dir":"${project_path:${file_path}}",

"path":"C:/Tools/node-webkit/",

"shell": true

}