mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-23 20:49:06 +01:00
21 lines
515 B
TypeScript
21 lines
515 B
TypeScript
|
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
|
||
|
});
|
||
|
}
|
||
|
}]
|
||
|
})
|
||
|
});
|