Skip to content

Commit 7c2fbdb

Browse files
committed
MOBILE-3333 gulp: Minimize HTML templates
1 parent 898cfc9 commit 7c2fbdb

File tree

3 files changed

+133
-1
lines changed

3 files changed

+133
-1
lines changed

gulpfile.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ var gulp = require('gulp'),
99
flatten = require('gulp-flatten'),
1010
npmPath = require('path'),
1111
concat = require('gulp-concat'),
12-
bufferFrom = require('buffer-from')
12+
htmlmin = require('gulp-htmlmin'),
13+
bufferFrom = require('buffer-from'),
1314
exec = require('child_process').exec,
1415
license = '' +
1516
'// (C) Copyright 2015 Moodle Pty Ltd.\n' +
@@ -293,6 +294,12 @@ gulp.task('copy-component-templates', function(done) {
293294

294295
gulp.src(templatesSrc, { allowEmpty: true })
295296
.pipe(flatten())
297+
// Check options here: https://github.com/kangax/html-minifier
298+
.pipe(htmlmin({
299+
collapseWhitespace: true,
300+
removeComments: true,
301+
caseSensitive: true
302+
}))
296303
.pipe(gulp.dest(templatesDest))
297304
.on('end', done);
298305
});

package-lock.json

Lines changed: 124 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
"gulp-clip-empty-files": "^0.1.2",
134134
"gulp-concat": "^2.6.1",
135135
"gulp-flatten": "^0.4.0",
136+
"gulp-htmlmin": "^5.0.1",
136137
"gulp-rename": "^1.3.0",
137138
"gulp-slash": "^1.1.3",
138139
"lodash.template": "^4.5.0",

0 commit comments

Comments
 (0)