From 37e4719d7d252c5fcb9e65576e0461c0533d5276 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 13 Feb 2018 13:18:03 +0900 Subject: [PATCH] wip --- package.json | 1 + webpack/module/rules/base64.ts | 2 +- webpack/module/rules/collapse-spaces.ts | 20 ++++++++++++++++++++ webpack/module/rules/index.ts | 2 ++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 webpack/module/rules/collapse-spaces.ts diff --git a/package.json b/package.json index fee512c7f..906d512dc 100644 --- a/package.json +++ b/package.json @@ -118,6 +118,7 @@ "gulp-uglify": "3.0.0", "gulp-util": "3.0.8", "highlight.js": "9.12.0", + "html-minifier": "^3.5.9", "inquirer": "5.0.1", "is-root": "1.0.0", "is-url": "1.2.2", diff --git a/webpack/module/rules/base64.ts b/webpack/module/rules/base64.ts index 529816bd2..6d7eaddeb 100644 --- a/webpack/module/rules/base64.ts +++ b/webpack/module/rules/base64.ts @@ -7,7 +7,7 @@ const StringReplacePlugin = require('string-replace-webpack-plugin'); export default () => ({ enforce: 'pre', - test: /\.(tag|js)$/, + test: /\.(vue|js)$/, exclude: /node_modules/, loader: StringReplacePlugin.replace({ replacements: [{ diff --git a/webpack/module/rules/collapse-spaces.ts b/webpack/module/rules/collapse-spaces.ts new file mode 100644 index 000000000..48fd57f01 --- /dev/null +++ b/webpack/module/rules/collapse-spaces.ts @@ -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: /^