Packaging a desktop application experience NW.js

1. Installation nw, (also available in the official website to download and configuration variables)

npm install nw -g

One of the most simple application nw, only to have index.html file and can package.json

 

2. Project preparation, the directory structure

app folder

+----index.html

+----package.json

index.html Code:

Copy the code
<!DOCTYPE html>
<html>
  <head>
    <title>Hello World!</title>
  </head>
  <body>
    <h1>Hello World!</h1>
  </body>
</html>
Copy the code

package.json :( codes may be used to generate npm init, the following two properties must)

{
  "name": "app",
  "main": "index.html"
}

 3. Run a look

nw app or nw.

 

4. compressed folder and renamed app.nw

 

5. app.nw packaged into a single executable file together with nw

Copy the app.nw to the next nw directory, execute

copy /b nw.exe+app.nw app.exe

Then there have been the executable file app.exe

 

6. You can create a new folder, you must put the files there, following the implementation of the necessary documents for the app.exe:

 

7. Enigma Virtual Box will download and install the package file,

Open the software,

Input path and output path of the input app.exe,

Then step 6 Add the relevant files in it,

Press the lower right corner of "Process"

We got a file of app_boxed.exe ,, move to anywhere, as long as this file to the user, you can double-click to run the third step effect occurs.

Guess you like

Origin www.cnblogs.com/liliuguang/p/11200441.html