OSDN Git Service

update enable function for bytom
[bytom/Byone.git] / build / util.js
1 const path = require('path')
2 const ExtractTextPlugin = require('extract-text-webpack-plugin')
3 const HtmlWebpackPlugin = require('html-webpack-plugin')
4
5 const PAGE_OPTIONS = {
6   title: '',
7   hash: true,
8   cache: true,
9   inject: 'body',
10   filename: 'pages/temp.html',
11   template: path.resolve(__dirname, './page.ejs'),
12   appMountId: 'app',
13   chunks: [],
14 }
15
16 exports.resolve = dir => path.join(__dirname, '..', dir || '')
17
18 exports.page = options => {
19   const {
20     title,
21     name,
22     chunks,
23     template
24   } = options
25   return new HtmlWebpackPlugin(Object.assign({}, PAGE_OPTIONS, {
26     title,
27     chunks,
28     template: template || PAGE_OPTIONS.template,
29     filename: `pages/${name}.html`
30   }))
31 }
32
33 exports.assetsPath = p => path.posix.join('assets', p)