6ae7d8ace1
`index.html.gz` now links properly to gzipped resources allowing them to be distributed unmodified and without the uncompressed resources. Change-Id: I253f5207de5b13a105dfb8ddd226d7da6ba2b34b
20 lines
538 B
JavaScript
20 lines
538 B
JavaScript
'use strict';
|
|
|
|
var gulp = require('gulp');
|
|
var gzip = require('gulp-gzip');
|
|
var config = require('../config');
|
|
var filter = require('gulp-filter');
|
|
var replace = require('gulp-replace');
|
|
|
|
gulp.task('gzip', function() {
|
|
var rewriteFilter = filter(config.gzip.rewrite, { restore: true });
|
|
|
|
return gulp.src(config.gzip.src)
|
|
.pipe(rewriteFilter)
|
|
.pipe(replace(/"((?:css|js)\/.*\.(?:css|js))"/g, '"$1.gz"'))
|
|
.pipe(rewriteFilter.restore)
|
|
.pipe(gzip(config.gzip.options))
|
|
.pipe(gulp.dest(config.gzip.dest));
|
|
|
|
});
|