forked from FoundKeyGang/FoundKey
wip
This commit is contained in:
parent
cbdc06ad71
commit
c775e7d965
4 changed files with 24 additions and 1 deletions
|
@ -118,6 +118,7 @@
|
||||||
"gulp-uglify": "3.0.0",
|
"gulp-uglify": "3.0.0",
|
||||||
"gulp-util": "3.0.8",
|
"gulp-util": "3.0.8",
|
||||||
"highlight.js": "9.12.0",
|
"highlight.js": "9.12.0",
|
||||||
|
"html-minifier": "^3.5.9",
|
||||||
"inquirer": "5.0.1",
|
"inquirer": "5.0.1",
|
||||||
"is-root": "1.0.0",
|
"is-root": "1.0.0",
|
||||||
"is-url": "1.2.2",
|
"is-url": "1.2.2",
|
||||||
|
|
|
@ -7,7 +7,7 @@ const StringReplacePlugin = require('string-replace-webpack-plugin');
|
||||||
|
|
||||||
export default () => ({
|
export default () => ({
|
||||||
enforce: 'pre',
|
enforce: 'pre',
|
||||||
test: /\.(tag|js)$/,
|
test: /\.(vue|js)$/,
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
loader: StringReplacePlugin.replace({
|
loader: StringReplacePlugin.replace({
|
||||||
replacements: [{
|
replacements: [{
|
||||||
|
|
20
webpack/module/rules/collapse-spaces.ts
Normal file
20
webpack/module/rules/collapse-spaces.ts
Normal file
|
@ -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: /^<template>([\s\S]+?)\r?\n<\/template>/, replacement: html => {
|
||||||
|
return minify(html, {
|
||||||
|
collapseWhitespace: true,
|
||||||
|
collapseInlineTagWhitespace: true,
|
||||||
|
keepClosingSlash: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
});
|
|
@ -6,8 +6,10 @@ import themeColor from './theme-color';
|
||||||
import vue from './vue';
|
import vue from './vue';
|
||||||
import stylus from './stylus';
|
import stylus from './stylus';
|
||||||
import typescript from './typescript';
|
import typescript from './typescript';
|
||||||
|
import collapseSpaces from './collapse-spaces';
|
||||||
|
|
||||||
export default lang => [
|
export default lang => [
|
||||||
|
collapseSpaces(),
|
||||||
i18n(lang),
|
i18n(lang),
|
||||||
license(),
|
license(),
|
||||||
fa(),
|
fa(),
|
||||||
|
|
Loading…
Reference in a new issue