When building cross platform apps using GitHub’s electron (website), you may run into the same issue I did a few days ago. When you want to automatically build the app Windows and MacOS directly from an MacOS system using the gulp-atom-electron module.
Setting the Windows App Icon didn’t work for me when building it from the Mac.
gulp-atom-electron has a dependency on
rcedit which is a small Windows executable that is responsible for updating either Windows Assemblies or Windows Executables to make resource changes from outside. GitHub itself has published a corresponding npm module which uses
wine to execute
wine rcedit app-name.exe --set-icon app-icon.ico if you’re executing the code on a MacOS or Linux system.
So that should work - so my thoughts. But there is a platform switch in
gulp-atom-electron that prevents
rcedit from being invoked. That’s why I’ve ended up with a public fork of
gulp-atom-electron named gulp-awesome-electron (website) which doesn’t prevent the execution.
The package isn’t on npm! Installation is shown below
###Installing the dependencies
wine is required to get this working on MacOS or Linux.
wine can easily be installed on MacOS using Homebrew (aka
brew). Wine has a dependency to
xquartz so you’ve to execute the following commands to install both
brew install wine may fail if you haven’t installed
xquartz yet. If so, follow the instructions to install
xquartz and try the
wine installation again.
Installing required npm packages for Gulp.JS
gulpfile does a lot of things, so I stripped it to only focus on electron stuff right here. In order to get the electron build working, I’ve used the following dependencies.
gulp-awesome-electron is exactly the same as for
gulp-atom-electron, if you haven’t used it yet, go and read the docs of the plugin first.
Align the paths to match those of your project and start the gulp script using
Once the build has finished, go and copy your Windows App to a Windows machine. OSX isn’t able to display the App Icon for Windows Executables.