2018-02-13 05:18:03 +01:00
|
|
|
import * as fs from 'fs';
|
|
|
|
const minify = require('html-minifier').minify;
|
|
|
|
|
|
|
|
export default () => ({
|
|
|
|
enforce: 'pre',
|
|
|
|
test: /\.vue$/,
|
|
|
|
exclude: /node_modules/,
|
2018-02-15 15:07:19 +01:00
|
|
|
loader: 'string-replace-loader',
|
|
|
|
query: {
|
|
|
|
search: /^<template>([\s\S]+?)\r?\n<\/template>/,
|
|
|
|
replace: html => {
|
|
|
|
return minify(html, {
|
|
|
|
collapseWhitespace: true,
|
|
|
|
collapseInlineTagWhitespace: true,
|
|
|
|
keepClosingSlash: true
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2018-02-13 05:18:03 +01:00
|
|
|
});
|