Build cross-platform desktop applications using JavaScript, HTML and CSS

Source: Internet
Author: User

  • https://electronjs.org/--official website
  • https://github.com/electron/electron-api-demos/releases--Download Demo

Download the installation:

# Clone the sample project's Warehouse $ git clone https: // Github.com/electron/electron-quick-start # Enter this warehouse $ cd electron-quick-&& npm start

Install package plugins/install and package:

NPM Install Electron-packager-g

The parameters below are the prototypes of the packaged execution command:

Electron-packager <sourcedir> <appname>--platform=<platform>--arch=<arch> [optional flags ...]
执行如下:
Electron-packager. App--win--out presentertool--arch=--version 1.4.14--overwrite--ignore=node_modules

成功运行完成后,生成文件:

Click to view the results as follows:



部分参数解释:
  • rimrafA deluxe version rm -rf that is compatible with window.
  • cross-envA deluxe version of the environment variable settings, where there is a NODE_ENV=* place, you can consider using CROSS-ENV, compatible with window.
  • ./, which is generally the location of the Package.json. See here for details: https://newsn.net/say/electron-quick-start-modify.html
  • appname, this will affect the name (Appname.exe) of the executable file (EXE/DMG) that you have finished packing.
  • --platformAnd --arch , these two parameters have very much deformation. Here is a detailed explanation: https://newsn.net/say/electron-packager-basic.html
  • --win32metadata.FileDescription, file description information. See here: https://newsn.net/say/electron-packager-exe-info.html
  • --overwrite, whether to overwrite the original build file. It is related to the following items: --out=out , --ignore=out , rimraf out .
  • --ignore, to exclude the non-packaged files, you can overlay the effect. The main reason is to reduce the final file size considerations.
  • --no-prune, this parameter should be used with caution, is said not to deal with node_modules inside the dev dependency package, the relevant code is put into the final asar inside. By default, the package inside the dev-related node_modules is removed and then packaged. Note: There are no parameters in the current version of Electron-packager --prune .
  • --electron-versionthat specifies the version of the electron to be used when packaging. See here: https://newsn.net/say/electron-packager-control-version.html. Note: The latest version electron-packager has no --version parameters.
  • --outWhere to put the executable files that you have finished packing.
  • --iconSet the icon when packaging. The key to knocking on the Blackboard , every day someone asked how to change this icon, here to replace. For the issue of icon making, see: Https://newsn.net/say/electron-mac-icns.html and https://newsn.net/say/electron-ico-format.html. Icons are special icons, in vain to make an icon can be a perfect replacement of the idea, are futile. Never mind.
  • --asarPackage options, if the App.asar file is generated under the resource folder. Otherwise it will be an app folder plus your own code file.

Build cross-platform desktop applications using JavaScript, HTML and CSS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.