Nativefier - 网页变为桌面应用 系统软件


https://github.com/nativefier/nativefier


npm install -g nativefier

nativefier <网址> <输出路径>


-将GitHub转化为桌面应用,你可以使用以下命令:

nativefier "https://github.com" ~/Desktop


-设置应用图标:

nativefier --name "My App" --icon ~/Desktop/myIcon.ico "https://example.com" ~/Desktop


-调整窗口大小:

nativefier --width 800 --height 600 "https://example.com" ~/Desktop


-修改原始代码:

-使用--inject选项来注入这个脚本:

nativefier --inject ~/Desktop/welcome.js "https://weather.com" ~/Desktop

-假设你想在应用启动时显示一个欢迎消息,你可以创建一个JavaScript文件welcome.js:

const { app, BrowserWindow } = require('electron')
app.on('ready', () => {
  let win = new BrowserWindow({ width: 800, height: 600 })
  win.webContents.on('did-finish-load', () => {
    win.webContents.send('show-message', 'Welcome to My Weather App!')
  })
  win.loadURL('https://weather.com')
})


Nativefier是一个基于Node.js的命令行工具,它使用Electron框架将网页应用打包成独立的桌面应用程序。这意味着你可以将任何你喜欢的网站,如新闻网站、在线工具或社交媒体平台,转化为可以在Windows、macOS和Linux上运行的桌面应用。


签名:这个人很懒,什么也没有留下!
最新回复 (0)
返回