如何在 Mac 上使用 electron-forge 包设置应用程序图标?
How to set the app icon using electron-forge package on Mac?
有人可以告诉我在使用 electron-forge package
编译电子应用程序(在 mac 上)时使用自定义图标的说明吗?使用 --icon
给我一个错误:
error: unknown option `--icon'
我错过了什么?
想通了。在 package.json
.
中配置图标的路径
Electron-Forge v5:
{
...
"config": {
"forge": {
...
"electronPackagerConfig": {
"icon": "path/to/icon.icns"
},
...
}
}
}
Electron-Forge v6:
{
...
"config": {
"forge": {
...
"packagerConfig": {
"icon": "path/to/icon.icns"
},
...
}
}
}
根据 the Options.icon
documentation:
If the file extension is omitted, it is auto-completed to the correct extension based on the platform, including when platform: 'all' is in effect
鉴于此,设置不带扩展名的值:
"icon": "./assets/icon"
这已确认适用于 Windows 和 Mac。
有人可以告诉我在使用 electron-forge package
编译电子应用程序(在 mac 上)时使用自定义图标的说明吗?使用 --icon
给我一个错误:
error: unknown option `--icon'
我错过了什么?
想通了。在 package.json
.
Electron-Forge v5:
{
...
"config": {
"forge": {
...
"electronPackagerConfig": {
"icon": "path/to/icon.icns"
},
...
}
}
}
Electron-Forge v6:
{
...
"config": {
"forge": {
...
"packagerConfig": {
"icon": "path/to/icon.icns"
},
...
}
}
}
根据 the Options.icon
documentation:
If the file extension is omitted, it is auto-completed to the correct extension based on the platform, including when platform: 'all' is in effect
鉴于此,设置不带扩展名的值:
"icon": "./assets/icon"
这已确认适用于 Windows 和 Mac。