Skip to content

Commit a458423

Browse files
committed
Use HtmlWebpackPlugin gen demo html.
1 parent cddb44d commit a458423

File tree

8 files changed

+31
-18
lines changed

8 files changed

+31
-18
lines changed

demos/demo.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en-US">
3+
<head>
4+
<meta charset="utf-8">
5+
<title><%= htmlWebpackPlugin.options.title %> demo of vue-virtual-scroll-list</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=0"/>
7+
</head>
8+
<body>
9+
<div id="app"></div>
10+
</body>
11+
</html>

demos/item-mode/index.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=0"/>
77
</head>
88
<body>
9-
<div id="app"></div>
10-
<script src="build.js"></script>
11-
</body>
9+
<div id="app"></div>
10+
<script type="text/javascript" src="build.js"></script></body>
1211
</html>

demos/page-mode/index.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=0"/>
77
</head>
88
<body>
9-
<div id="app"></div>
10-
<script src="build.js"></script>
11-
</body>
9+
<div id="app"></div>
10+
<script type="text/javascript" src="build.js"></script></body>
1211
</html>

demos/variable-height/index.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
<html lang="en-US">
33
<head>
44
<meta charset="utf-8">
5-
<title>variable height demo of vue-virtual-scroll-list</title>
5+
<title>variable-height demo of vue-virtual-scroll-list</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=0"/>
77
</head>
88
<body>
9-
<div id="app"></div>
10-
<script src="build.js"></script>
11-
</body>
9+
<div id="app"></div>
10+
<script type="text/javascript" src="build.js"></script></body>
1211
</html>

demos/vfor-mode/index.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=0"/>
77
</head>
88
<body>
9-
<div id="app"></div>
10-
<script src="build.js"></script>
11-
</body>
9+
<div id="app"></div>
10+
<script type="text/javascript" src="build.js"></script></body>
1211
</html>

demos/webpack.conf.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const path = require('path')
22
const { lstatSync, readdirSync } = require('fs')
33
const VueLoaderPlugin = require('vue-loader/lib/plugin')
4+
const HtmlWebpackPlugin = require('html-webpack-plugin')
45

56
const isProduction = process.env.NODE_ENV === 'production'
67

@@ -15,6 +16,7 @@ let multiConfigs = []
1516
demoDirectorys.forEach((entry) => {
1617
const _entry = path.resolve(__dirname, entry)
1718
multiConfigs.push({
19+
name: entry,
1820
entry: `${_entry}/main.js`,
1921
output: {
2022
filename: 'build.js',
@@ -43,7 +45,11 @@ module.exports = multiConfigs.map((config) => {
4345
},
4446

4547
plugins: [
46-
new VueLoaderPlugin()
48+
new VueLoaderPlugin(),
49+
new HtmlWebpackPlugin({
50+
title: config.name,
51+
template: path.resolve(__dirname, './demo.html')
52+
})
4753
],
4854

4955
devtool: '#source-map',

demos/without-virtual-list/index.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
<html lang="en-US">
33
<head>
44
<meta charset="utf-8">
5-
<title>without use virtual-list</title>
5+
<title>without-virtual-list demo of vue-virtual-scroll-list</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=0"/>
77
</head>
88
<body>
9-
<div id="app"></div>
10-
<script src="build.js"></script>
11-
</body>
9+
<div id="app"></div>
10+
<script type="text/javascript" src="build.js"></script></body>
1211
</html>

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"eslint-plugin-promise": "^4.0.1",
6262
"eslint-plugin-standard": "^4.0.0",
6363
"eslint-plugin-vue": "^5.2.2",
64+
"html-webpack-plugin": "^3.2.0",
6465
"jest": "^24.7.0",
6566
"less": "^3.9.0",
6667
"less-loader": "^4.1.0",

0 commit comments

Comments
 (0)