Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mazeyqian/multipage-template
Webpack multi-page and GitLab incremental build deployment template/Webpack 多页面&GitLab 增量构建部署模板
https://github.com/mazeyqian/multipage-template
cicd gitlab html multi-page template webpack
Last synced: 2 months ago
JSON representation
Webpack multi-page and GitLab incremental build deployment template/Webpack 多页面&GitLab 增量构建部署模板
- Host: GitHub
- URL: https://github.com/mazeyqian/multipage-template
- Owner: mazeyqian
- Created: 2017-10-25T09:32:54.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-24T05:55:05.000Z (5 months ago)
- Last Synced: 2024-07-30T17:35:01.085Z (5 months ago)
- Topics: cicd, gitlab, html, multi-page, template, webpack
- Language: JavaScript
- Homepage:
- Size: 865 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
English | [简体中文](./README_CN.md)
# multipage-template
Webpack multi-page and GitLab incremental build deployment template.
## Entry
Each new standalone page only needs to create a folder under `pages`, but must have two entry files: `index.html` and `index.js`.
```
├── package.json
└── src
├── index.js // pages - You can put common things on the outside.
└── pages
├── page1
│ ├── index.js
│ └── index.html
└── page2
├── style.css
├── index.js
└── index.html
```## Output
Each packaged page is independent.
```
├── package.json
└── dist
├── page1
│ ├── index.html
│ └── 20210526.194300
│ ├── 7ffaa4103cae71b1629a.css
│ └── 7ffaa4103cae71b1629a.js
└── page2
├── index.html
└── 20210526.194300
├── 88870cd4b2e554c2a754.css
└── 88870cd4b2e554c2a754.js
```## Deploy
### Aliyun OSS
Use GitLab variable to run out of modified `pages` folder, and use Aliyun OSS CLI [aliyunoss-cli](https://github.com/mazeyqian/aliyunoss-cli) to upload packaged files automatically.
```
search_dir=src/pages
for path in "$search_dir"/*; do
echo "$(git diff HEAD~ --name-only | grep "$path")"
if [ "$(git diff HEAD~ --name-only | grep "$path/")" ]; then
page_name=$(basename $path)
echo "[CI] Page \"$page_name\" has been modified"
echo "[CI] Start building"
npx cross-env NODE_ENV=production PAGE=$page_name node build/build.js
fi
done
```### Docker
The page can be visited on `http://localhost:7415` by running the command: `bash DockerBuild.sh`.
## Notification
### WeixinWork
The notification will be opened after filling the file: `build\shell\notification.sh`.
## Reference
[Use GitLab CI/CD and Aliyun CLI to deploy front-end projects](https://blog.mazey.net/1695.html)
## Appendix
Address of this project: [https://github.com/mazeyqian/multipage-template](https://github.com/mazeyqian/multipage-template)