基于template做代码结构调整

This commit is contained in:
许彦峰
2019-03-15 19:10:02 +08:00
parent 4e808384fe
commit 9579ed24d2
42 changed files with 68714 additions and 2085 deletions

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<div id="app"></div>
</body>
</html>

View File

@@ -0,0 +1,17 @@
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
htmlPage(title, filename, chunks, template) {
return new HtmlWebpackPlugin({
title: title,
hash: true,
cache: true,
inject: 'body',
filename: './pages/' + filename + '.html',
template: template || path.resolve(__dirname, './page.ejs'),
appMountId: 'app',
chunks: chunks
});
}
}