From c775e7d9659e99db196c956b2f224ec33b8bbaeb 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 fee512c7ff..906d512dc1 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 529816bd20..6d7eaddeba 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 0000000000..48fd57f017 --- /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: /^