Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gogoyqj/wechatappboilerplate
a boilerplate to pack wechat app using rollup to save size!!
https://github.com/gogoyqj/wechatappboilerplate
rollup wechat-aplet-pack wechat-app wechat-applet wei-xin
Last synced: 9 days ago
JSON representation
a boilerplate to pack wechat app using rollup to save size!!
- Host: GitHub
- URL: https://github.com/gogoyqj/wechatappboilerplate
- Owner: gogoyqj
- License: bsd-2-clause
- Created: 2017-04-17T07:02:22.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-04-18T08:10:54.000Z (over 7 years ago)
- Last Synced: 2024-10-12T10:23:57.093Z (2 months ago)
- Topics: rollup, wechat-aplet-pack, wechat-app, wechat-applet, wei-xin
- Language: JavaScript
- Size: 3.91 KB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.cn.md
- License: LICENSE
Awesome Lists containing this project
README
## 微信小程序模板
一切为了:瘦身,瘦身,瘦身
### 简介
通过采用 rollup 对项目预先进行构建,合并所有页面代码到 app.js,并将 APP 替换成 __app :
```jsx
__page(1)({ ... });
function __page(routeIndex) {
return function(e) {
getApp().__pages[routeIndex] = function() {
Page(e)
}
}
}
```实际页面的代码则相应变成调用 :
```jsx
getApp().__run(0);
```以此减小最终构建的小程序体积——页面越多,瘦身效果越明显。
### 使用
用 rollup 构建 src 源码到 dist 内
```shell
git clone [email protected]:gogoyqj/wechatAppBoilerplate.git projectPath;
cd projectPath;
npm install;
// make changes
xxx
// build
sh init.sh;
```### 项目结构
#### src
项目源码
```shell
src/app.js
src/app.json
```#### dist
对应“微信 web 开发者工具”内“添加项目”时的“项目目录”,如果不采用本模板提供的打包解决方案,则应选择 src 目录。