mobile-pipe-for-tianma

0.0.5 • Public • Published

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

FAQ

Readme

Keywords

none

Package Sidebar

Install

npm i mobile-pipe-for-tianma

Weekly Downloads

0

Version

0.0.5

License

none

Last publish

Collaborators

  • siemenliu