1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-11-01 23:55:58 +09:00
cherrypick/webpack/module/rules/collapse-spaces.ts

20 lines
415 B
TypeScript
Raw Normal View History

2018-02-13 13:18:03 +09:00
import * as fs from 'fs';
const minify = require('html-minifier').minify;
export default () => ({
enforce: 'pre',
test: /\.vue$/,
exclude: /node_modules/,
2018-02-15 23:07:19 +09: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 13:18:03 +09:00
});