weex-toolkit打包

需要2.15.1及以上的npm支持

运行终端,查看版本

npm --version

如果版本低于2.15.1,需要更新

sudo npm install -g npm

安装weex-toolkit

npm install -g weex-toolkit

weex命令使用方法

weex foo/bar/we_file_or_dir_path  [options]
weex init
 
Options:
  --qr     display QR code for native runtime, 
  -o,--output  transform weex we file to JS Bundle, output path (single JS bundle file or dir)
           [for create sub cmd] it specified we file output path                    
  --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
  -h, --host  specify server listening  IP 
  --port   http listening port number ,default is 8081            
  --wsport websocket listening port number ,default is 8082
  -f, --force   [for create sub cmd] force to replace exsisting file(s)
  --np     do not open preview browser automatic        
  --version show version of weex toolkit 
  --help   Show help  

示例

1.预览.we文件内容

weex your_best_weex.we

2.转换单个js包

weex your_best_weex.we -o .

3.转换.we目录为.js目录

weex we/file/storage/path -o outputpath

4.在官方示例中看自己的测试

weex your_best_weex.we --qr

5.启动本地服务

weex -s .
原文地址:https://www.cnblogs.com/Jsonlu/p/5635663.html