mirror of
https://github.com/c8r/x0.git
synced 2024-09-11 13:45:52 +03:00
19 lines
485 B
JavaScript
19 lines
485 B
JavaScript
const { generateJSReferences } = require('mini-html-webpack-plugin')
|
|
const { minify } = require('html-minifier')
|
|
const defaultTemplate = require('./template')
|
|
|
|
module.exports = opts => {
|
|
const template = opts.template || defaultTemplate
|
|
return context => {
|
|
const scripts = generateJSReferences(context.js, context.publicPath)
|
|
return minify(
|
|
template(Object.assign({}, context, {
|
|
scripts
|
|
})),
|
|
{
|
|
collapseWhitespace: true
|
|
}
|
|
)
|
|
}
|
|
}
|