Weex environment building (win7) and weex environment building win7

Source: Internet
Author: User
Tags install node

Weex environment building (win7) and weex environment building win7
Install Node. js and install weex-toolkit

After installing node. js, open the CMD Tool and install weex-toolkit. This is the integration environment of weex.

npm install -g weex-toolkit

With weex-toolkit, you can use the weex command.

The version I used is that this may change very quickly.


Let's take a look at the weex command.

Usage: weex foo/bar/we_file_or_dir_path  [options]Usage: weex debug [options] [we_file|bundles_dir]Usage: weex init Options:  --qr          display QR code for PlaygroundApp                      [boolean]   --smallqr     display small-scale version of QR code for PlaygroundApp,try it                if you use default font in CLI                         [boolean]   -o, --output  transform weex we file to JS Bundle, output path must specified                (single JS bundle file or dir)                [for create sub cmd]it specified we file output path                                                 [default: "no JSBundle output"]   --watch       using with -o , watch input path , auto run transform if change                happen  -s, --server  start a http file server, weex .we file will be transforme to JS                 bundle on the server , specify local root path using the option                                                                        [string]   --port        http listening port number ,default is 8081        [default: -1]   --wsport      websocket listening port number ,default is 8082   [default: -1]   --np          do not open preview browser automatic                  [boolean]   -f, --force   [for create sub cmd]force to replace exsisting file(s) [boolean]   -h, --host                                              [default: "127.0.0.1"]  weex debug -h for Weex debug help information. for cmd example & more information please visithttps://www.npmjs.com/package/weex-toolkit

If you only want to debug a we file, run weex xxx. we to run it in a local browser.

weex test.we --qr -h

-- Qr code displays the qr code of the local address file. After playground is installed, you can scan the qr code to view the page of the we file.
-H is a hot update, of course, only valid for browsers

Initialize project hello weex

Create an app folder first. Here is the Directory D: \ webxm \ nodejs \ weex-test.

Then use cmd to enter the weex-text directory, or directly open cmd in this directory (Press and hold shift and right-click and choose [open command window here ])

Run the following command:

Press enter to display the following information:

file: .gitignore created.file: README.md created.file: index.html created.file: package.json created.file: src/main.we created.file: webpack.config.js created.

Install the dependency

npm install

Now we have created a directory and initialized a weex-test project here.

Directory structure

Src-code directory
Index-browser startup page
Webpack. config. js-webpack configuration file
Observe that package. json contains the following four commands:

{  "name": "weex-test",  "version": "1.0.0",  "description": "",  "main": "index.js",  "scripts": {    "build": "webpack",    "dev": "webpack --watch",    "serve": "serve -p 8080",    "test": "echo \"Error: no test specified\" && exit 1"  },

Changed to the following (8080 port can be changed as needed)

{"name": "weex-test","version": "1.0.0","description": "","main": "index.js","scripts": {"build": "webpack","dev": "webpack & serve -p 8080","test": "echo \"Error: no test specified\" && exit 1"},

Start this project now

npm run dev


Visit localhost: 8080 in the browser and the following page will appear:

Now we have started this project.

Another startup Method

First, go to the src working directory and run the corresponding we file. The command is as follows:

weex xxx.we

The file I run is this

The window in your system's default browser will automatically open and display Hello Weex!

Portal:Weex real machine debugging QR code

 

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.