Skip to content

Commit

Permalink
[Build] enable site pwa (youzan#3736)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Jul 3, 2019
1 parent 66459df commit 3dd881a
Show file tree
Hide file tree
Showing 14 changed files with 357 additions and 191 deletions.
1 change: 0 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ module.exports = function (api) {
useESModules
}
],
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-object-assign'
]
};
Expand Down
2 changes: 1 addition & 1 deletion docs/markdown/intro.en-US.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="card">
<div class="van-doc-intro">
<img class="van-doc-intro__logo" style="width: 120px; height: 120px; box-shadow: none;" src="//img.yzcdn.cn/public_files/2017/12/18/fd78cf6bb5d12e2a119d0576bedfd230.png">
<img class="van-doc-intro__logo" style="width: 120px; height: 120px; box-shadow: none;" src="https://img.yzcdn.cn/vant/logo.png">
<h2 style="margin: 0; font-size: 36px; line-height: 60px;">Vant</h2>
<p>Mobile UI Components built on Vue</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/markdown/intro.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="card">
<div class="van-doc-intro">
<img class="van-doc-intro__logo" style="width: 120px; height: 120px; box-shadow: none;" src="//img.yzcdn.cn/public_files/2017/12/18/fd78cf6bb5d12e2a119d0576bedfd230.png">
<img class="van-doc-intro__logo" style="width: 120px; height: 120px; box-shadow: none;" src="https://img.yzcdn.cn/vant/logo.png">
<h2 style="margin: 0; font-size: 36px; line-height: 60px;">Vant</h2>
<p>轻量、可靠的移动端 Vue 组件库</p>
</div>
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,14 @@
},
"devDependencies": {
"@babel/core": "^7.4.5",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-jsx": "^7.2.0",
"@babel/plugin-transform-object-assign": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/polyfill": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@babel/preset-typescript": "^7.3.3",
"@types/jest": "^24.0.15",
"@vant/doc": "^2.3.3",
"@vant/doc": "^2.3.4",
"@vant/eslint-config": "^1.2.0",
"@vant/markdown-loader": "^2.0.0",
"@vant/markdown-vetur": "^1.0.0",
Expand All @@ -94,7 +93,7 @@
"jest-serializer-vue": "^2.0.2",
"less": "^3.8.1",
"less-loader": "^5.0.0",
"lint-staged": "^9.0.0",
"lint-staged": "^9.0.2",
"postcss": "^7.0.17",
"postcss-loader": "^3.0.0",
"shelljs": "^0.8.3",
Expand Down
3 changes: 2 additions & 1 deletion site/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@vant/site",
"name": "Vant",
"version": "1.0.0",
"scripts": {
"serve": "vue-cli-service serve",
Expand All @@ -11,6 +11,7 @@
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.1.1",
"@vue/cli-plugin-pwa": "^3.8.0",
"@vue/cli-plugin-typescript": "^3.8.1",
"@vue/cli-service": "^3.1.4"
},
Expand Down
Binary file added site/public/img/icons/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/icons/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 12 additions & 4 deletions site/public/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover">
<link rel="shortcut icon" href="https://img.yzcdn.cn/zanui/vant/vant-2017-12-18.ico">
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"
/>
<link
rel="shortcut icon"
href="https://img.yzcdn.cn/zanui/vant/vant-2017-12-18.ico"
/>
<link href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css" rel="stylesheet" />
<title>Vant - 轻量、可靠的移动端 Vue 组件库</title>
</head>
<body ontouchstart>
<div id="app"></div>
<script src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>
<!-- built files will be auto injected -->
</body>
</html>
20 changes: 20 additions & 0 deletions site/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "Vant",
"short_name": "Vant",
"icons": [
{
"src": "./img/icons/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "./img/icons/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"start_url": "./index.html",
"display": "standalone",
"background_color": "#000000",
"theme_color": "#4DBA87"
}
20 changes: 20 additions & 0 deletions site/public/mobile.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"
/>
<link
rel="shortcut icon"
href="https://img.yzcdn.cn/zanui/vant/vant-2017-12-18.ico"
/>
<title>Vant - 轻量、可靠的移动端 Vue 组件库</title>
</head>
<body ontouchstart>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
13 changes: 3 additions & 10 deletions site/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,10 @@ const path = require('path');

module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? '/vant/' : '/',
productionSourceMap: false,
pages: {
index: {
entry: 'src/desktop/main.js',
template: 'public/index.html',
filename: 'index.html'
},
mobile: {
entry: 'src/mobile/main.js',
template: 'public/index.html',
filename: 'mobile.html'
}
index: 'src/desktop/main.js',
mobile: 'src/mobile/main.js'
},
chainWebpack: config => config.resolve.extensions.prepend('.md'),
configureWebpack: {
Expand Down
Loading

0 comments on commit 3dd881a

Please sign in to comment.