This commit is contained in:
syuilo 2018-02-13 13:18:03 +09:00
parent cbdc06ad71
commit c775e7d965
4 changed files with 24 additions and 1 deletions

View file

@ -0,0 +1,20 @@
import * as fs from 'fs';
const minify = require('html-minifier').minify;
const StringReplacePlugin = require('string-replace-webpack-plugin');
export default () => ({
enforce: 'pre',
test: /\.vue$/,
exclude: /node_modules/,
loader: StringReplacePlugin.replace({
replacements: [{
pattern: /^<template>([\s\S]+?)\r?\n<\/template>/, replacement: html => {
return minify(html, {
collapseWhitespace: true,
collapseInlineTagWhitespace: true,
keepClosingSlash: true
});
}
}]
})
});