开发工具目录结构
--E:\develop\ ----node-webkit-v0.9.2-win-ia32 ----Sublime Text 2.0.2 x64
为Sublime text2构建Build环境
打开sublime text2 菜单->tools->build system->new build system,输入如下代码:
{ "cmd": ["nw", "${project_path:${folder}}"], "working_dir": "${project_path:${folder}}", "path": "E:\\develop\\node-webkit-v0.9.2-win-ia32" }
测试
测试代码目录结构
--G:\Temp\NodeWebkit-test ----index.html ----package.json
index.html文件内容
<!DOCTYPE html> <html> <head> <title>Hello World!</title> </head> <body> <h1>Hello World!</h1> We are using node.js <script>document.write(process.version)</script>. <button onclick="js:alert(‘hello‘)">click me</button> </body> </html>
package.json文件内容
{ "name": "nw-demo", "main": "index.html", "window":{ "toolbar":false, "frame":true } }
步骤
- 打开代码文件G:\Temp\NodeWebkit-test\index.html
- 选择Tools->buildSystem->选中node-webkit
- 选择Project -> Add Folder to Project加入当前项目文件夹(通过View->Side Bar->Show Side Bar查看)
- 之后每次写完代码后点击tools->build后即可自动调用node-webkit启动当前的代码