| 不务正业系列,但是很好玩的一个东西!

| 教你把一个网站打包成一个可安装的桌面软件。

环境准备

- NodeJs
- Mac / Wins / Linux

工具安装

$ npm i -g nativefier

开始制作

选定好要制作的网页。例如:https://github.com

  1. 最简单的命令
    $ nativefier "https://github.com"
    
  2. 指定软件名称以及图标
    $ nativefier --name "github" --icon "/Users/kai/Downloads/linux_icon.png"  "https://github.com"
    
    | PS: 关于 icon 的要求,在Linx 和 Mac 上可以是 png 的图片。但是在 Wins 上则必须是 .ico 文件!
  3. 打包其他平台的安装包
    # 个人的是 Mac,所以用上面命令打包出来的默认是 Mac 上的。
    $ nativefier --name "github" -p "windows"  --icon "/Users/kai/Downloads/win_icon.ico" "https://github.com"  # 此为 wins 上的
    $ nativefier --name "github" --icon "/Users/kai/Downloads/linux_icon.png" -p "linux"  "https://github.com"  # 此为 Linux 平台的
    
    | PS: 具体还有很多可供选择的选项,比如宽高,伸缩性,授权等等,具体可参考官方文档!