gulp-gzip
Gzip plugin for gulp.
# Install
npm install --save-dev gulp-gzip
Options
Boolean
append Appends .gz
file extension if true. Defaults to true.
filename.txt
becomes filename.txt.gz
.
String
extension Appends an arbitrary extension to the filename. Disables append
and preExtension
options.
// note that the `.` should not be included in the extension
filename.txt
becomes filename.txt.zip
.
String
preExtension Appends an arbitrary pre-extension to the filename. Disables append
and extension
options.
// note that the `.` should not be included in the extension
filename.txt
becomes filename.gz.txt
.
String|Number|Boolean
threshold Minimum size required to compress a file. Defaults to false.
Object
gzipOptions Options object to pass through to zlib.Gzip. See zlib documentation for more information.
String|Function
deleteMode Some webserver modules such as nginx gzip_static
looks for example.html.gz
, serve it if it exists, else the original example.html
will be served.
For instance, if example.html
was 2kb, it would be gzipped and example.html.gz
was created.
However, if later example.html
is modified to content less than the threshold, gulp-gzip will only bypass it. Hence, you will end up with a new example.html
yet old example.html.gz
. Your webserver will continue to serve old content (example.html.gz
).
Using this option, gulp-gzip will remove example.html.gz
.
It takes in the same argument as gulp.dest
as in gulp.dest('mydest')
, so it knows where to look for the gzipped files. Defaults to undefined
.
If you have cwd
as in gulp.dest('mydest', { cwd: mycwd })
. You can configure it using deleteModeCwd
.
Boolean
skipGrowingFiles Some files actually get larger after compression. If true, this option passes along the original, uncompressed file if compression increases the file size. Defaults to false.
Examples
var gulp = ;var gzip = ; gulp;
var gulp = ;var coffee = ;var concat = ;var uglify = ;var gzip = ; gulp;
var gulp = ;var tar = ;var gzip = ; gulp;