This commit is contained in:
syuilo 2017-08-10 22:37:35 +09:00
parent 84d0ad12d1
commit e21f4d3a5b
2 changed files with 30 additions and 1 deletions

View File

@ -18,6 +18,7 @@ import imagemin = require('gulp-imagemin');
import * as rename from 'gulp-rename'; import * as rename from 'gulp-rename';
import * as mocha from 'gulp-mocha'; import * as mocha from 'gulp-mocha';
import * as replace from 'gulp-replace'; import * as replace from 'gulp-replace';
import * as htmlmin from 'gulp-htmlmin';
const uglifyes = require('uglify-es'); const uglifyes = require('uglify-es');
import version from './src/version'; import version from './src/version';
@ -161,5 +162,31 @@ gulp.task('build:client:pug', [
themeColor: constants.themeColor themeColor: constants.themeColor
} }
})) }))
.pipe(htmlmin({
// 真理値属性の簡略化 e.g.
// <input value="foo" readonly="readonly"> to
// <input value="foo" readonly>
collapseBooleanAttributes: true,
// テキストの一部かもしれない空白も削除する e.g.
// <div> <p> foo </p> </div> to
// <div><p>foo</p></div>
collapseWhitespace: true,
// (できる場合は)属性のクォーテーション削除する e.g.
// <p class="foo-bar" id="moo" title="blah blah">foo</p> to
// <p class=foo-bar id=moo title="blah blah">foo</p>
removeAttributeQuotes: true,
// 省略可能なタグを省略する e.g.
// <html><p>yo</p></html> ro
// <p>yo</p>
removeOptionalTags: true,
// 属性の値がデフォルトと同じなら省略する e.g.
// <input type="text"> to
// <input>
removeRedundantAttributes: true
}))
.pipe(gulp.dest('./built/web/app/')) .pipe(gulp.dest('./built/web/app/'))
); );

View File

@ -35,6 +35,7 @@
"@types/express": "4.0.36", "@types/express": "4.0.36",
"@types/gm": "1.17.32", "@types/gm": "1.17.32",
"@types/gulp": "4.0.3", "@types/gulp": "4.0.3",
"@types/gulp-htmlmin": "1.3.30",
"@types/gulp-mocha": "0.0.30", "@types/gulp-mocha": "0.0.30",
"@types/gulp-rename": "0.0.32", "@types/gulp-rename": "0.0.32",
"@types/gulp-replace": "0.0.30", "@types/gulp-replace": "0.0.30",
@ -70,6 +71,7 @@
"gulp": "3.9.1", "gulp": "3.9.1",
"gulp-cssnano": "2.1.2", "gulp-cssnano": "2.1.2",
"gulp-imagemin": "3.3.0", "gulp-imagemin": "3.3.0",
"gulp-htmlmin": "3.0.0",
"gulp-mocha": "4.3.1", "gulp-mocha": "4.3.1",
"gulp-pug": "3.3.0", "gulp-pug": "3.3.0",
"gulp-rename": "1.2.2", "gulp-rename": "1.2.2",
@ -148,6 +150,6 @@
"uuid": "3.1.0", "uuid": "3.1.0",
"vhost": "3.0.2", "vhost": "3.0.2",
"websocket": "1.0.24", "websocket": "1.0.24",
"xev": "^2.0.0" "xev": "2.0.0"
} }
} }