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

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

Mac OS X

1.下载node-webkit.app并放在/Application文件夹内
2.从sublime text 2菜单选择Tools -> Build System -> New Build System
3.输入如下代码:node

{
    "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中看到调试输出web

在sublime text3中使用方法同样。shell

Windows

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

{
    "cmd": ["nw.exe", "--enable-logging", "${project_path:${file_path}}"],
    "working_dir": "${project_path:${file_path}}",
    "path": "C:/Tools/node-webkit/",
    "shell": true
}
相关文章
相关标签/搜索