package
A gulp plugin to optionally compress output with gzip and brotli
npm install gulp-web-compressGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
A gulp plugin to optionally compress output with gzip and brotli.
import {pipeline} from 'stream';
import gulp from 'gulp';
import gulpWebCompress from 'gulp-web-compress';
gulp.task('default', () => pipeline(
gulp.src('src/**'),
/* perform build steps */
gulp.dest('dest', {sourceMaps: '.'}),
gulpWebCompress(),
gulp.dest('dest'),
error => {
if (error) {
console.error(error);
}
}
));gulp.dest must be called before and after gulpWebCompress. The first call to
gulp.dest generates source-map files and writes the uncompressed files. All
files (including source-maps) are then passed to gulpWebCompress which produces
*.gz and *.br files. Only compressed files reach the second call to gulp.dest.
An array of zero or more strings can be provided.
Default ['br', 'gz]
Valid types are br for brotli compression, gz for gzip compression.
This prevents creation of compressed files that are larger than the uncompressed files.
Default true
See node.js zlib options documentation. Example:
gulpCompress({
types: ['gz'],
gzipOptions: {
level: 9
}
})See brotliEncodeParams documentation. Example:
gulpCompress({
types: ['br'],
brotliOptions: {
mode: 0,
quality: 11
}
})Estimated unpacked size across 15 packages.
365.4 kB
Includes dependencies.