mobile-pipe-for-tianma

m.alibaba.com develop tool for tianma

mobile-pipe-for-tianma

###How to use

1 - 命令行访问到tianma 0.5.x目录下,执行

npm install mobile-pipe-for-tianma

2 - 修改tianma config.js,新增pipe配置

var tianma = require('tianma');
var pipe = tianma.pipe;

// 1. 引入mobile 模块 var mobile = require('mobile-pipe-for-tianma');

tianma({ silent: false, log: false }) .createHost({ port: 80, portssl: 443, key:"./keys/unicorn.key", cert:"./keys/unicorn.cer"}) .mount('style.aliunicorn.com', [ // unicorn service pipe.combo({ source: 'http://style.alibaba.com/' }) ]) // 2. 新增pipe .mount('m.alibaba.com', [ mobile({ root: './htdocs' }) ]) .mount('/', [ // static service pipe.static({ root: './htdocs' }), pipe.proxy({ 'http://110.75.216.150/$1': /(?:(?:style|img).(?:alibaba|aliexpress).com|aliimg.com)/(.*)/ }), pipe.beautify() ]) .start();

3 - 修改hosts指向

127.0.0.1 style.aliunicorn.com m.alibaba.com

4 - 启动tianma 0.5.x

5 - 使用chrome/safari访问

http://m.alibaba.com