需要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 .
