nw.js打包网站为桌面应用程序

 

  

下载nw.js 地址:https://nwjs.io/

下载Enigma Virtual Box 地址:http://enigmaprotector.com/en/aboutvb.html

解压nw.js ,在根目录创建项目文件夹app

在app文件夹下创建index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>demo</title>
</head>
<body>
<script>
    window.location.href = "http://XXXXXX/public/index.php";
</script>
</body>
</html>

  创建 package.json

{
  "name": "demo",
  "version": "1.0.0",
  "main": "index.html",
  "window": {
    "width": 1024,
    "height": 768,
    "title": "xtycgl"
  }
}

  main是入口文件,也可以是远程网站地址

然后把这两个文件添加到压缩文件 app.zip

改后缀zip为nw

把app.nw拖进nw.exe看下效果

需要分发运行的话把nw.exe和app.nw打到一起

命令行:

copy /b nw.exe+app.nw app.exe

注意nw.exe在前面

打开安装好的Enigma Virtual Box 

添加app.exe 和重命名

在file里添加nw运行必须的文件dll等和文件夹下的文件。
点击右下角process,成功!



猜你喜欢

转载自www.cnblogs.com/yixing/p/9140619.html