Skip to content

romeovs/gulp-zopfli

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

gulp-zopfli

a Zopfli plugin for gulp, based on node-zopfli.

Install

npm install --save-dev gulp-zopfli

Options

You can pass an options array to the zopfli object. These options are passed on to node-zopfli library, except for one: the format options is used to pick a compression format. The possible formats are: "deflate", "zlib" or "gzip".

The defaults options are:

{
    format: "gzip",
    verbose: false,
    verbose_more: false,
    numiterations: 15,
    blocksplitting: true,
    blocksplittinglast: false,
    blocksplittingmax: 15
};

Examples

var gulp = require("gulp");
var zopfli = require("gulp-zopfli");

gulp.task("compress", function() {
	gulp.src("./dev/scripts/*.js")
	.pipe(zopfli())
	.pipe(gulp.dest("./public/scripts"));
});

gulp.task("default", function() {
  gulp.run("compress");
});

Since the plugin is based largely on it, if you're already using gulp-gzip, switching to zopfli should be as easy as replacing

var gzip = require("gulp-gzip");

by

var gzip = require("gulp-zopfli");

Credit

This plugin was based largely on gulp-gzip, I basically just replaced gzip by zopfli so all credit is due to Jeremy.

About

A gulp plugin for node-zopfli

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published