legao-mobile
v0.0.1
Published
* 下载并安装[Node](http://nodejs.org/)以及[tnpm](http://web.npm.alibaba-inc.com/package/tnpm), 具体请参考[Node.js开发环境搭建](http://node.alibaba-inc.com/env/README.html)。
Downloads
5
Maintainers
Readme
准备
- 下载并安装Node以及tnpm, 具体请参考Node.js开发环境搭建。
开始
- 下载最新ZIP安装包。解压之后,修改代码库的名称为你自己的项目名称。
- 安装项目依赖库
tnpm install
。 - 启动项目
npm start
。打开 http://localhost:8080 即可访问index.html。
构建打包
npm run release
进行图片压缩、上传图片和相对地址替换,执行htmlone内联js、css,发布html生成在publish目录上。
新建页面
npm run add -- [demo]
src目录下会新建一个view:src/views/demo.html
,src/views/demo.js
,src/views/demo.less
。
Weinre调试
npm run weinre
自动往html里注入weinre脚本,无需手动引入。
配置
tools/config.js
可以进行一些配置
module.exports = {
//Rem配置
px2rem: {
rootValue: 75, //rem根值,视觉稿宽度/10
minPx: 1, //超过minPx才转化成rem
unitPrecision: 5, //rem小数点精度
propertyBlackList: [], //rem转换黑名单
propertyWhiteList: [] //rem转换白名单
},
port: 8080, //端口
imagemin: true, //是否进行图片压缩
noRecord: false
}
单/多页面支持
约定/src/views/[page]/package.json
中的main
字段为页面的入口文件,同目录上存在与入口文件同名的html
。
在编译时会扫描入口html文件并且根据webpack配置项解决entry的路径依赖。
这样可以做到同时支持SPA和多页面型的项目。
其他
- 编译后的文件存放在build目录下,包括html,html里不需要手动引入页面js和css,编译会自动引入。
- 默认视觉稿宽度为750,所以rem的rootValue为75,如为其他宽度,修改
tools/config.js
的rootValue
的值(视觉稿宽度/10
)。