Skip to content

GeKorm/gulp-zopfli-green

 
 

Repository files navigation

gulp-zopfli-green

Greenkeeper badge

This is a fork of gulp-zopfli that aims to keep all dependencies updated.

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

NPM version Linux Build Status Coverage Status Dependency Status devDependency Status

Install

  • Yarn: yarn add -D gulp-zopfli-green
  • Npm: npm i -D gulp-zopfli-green

Options

format String

Choose an output format, you can choose between gzip, zlib or deflate. Defaults to gzip.

zopfli({ format: 'zlib' });

append Boolean

Appends .gz, .zz or .deflate file extension if true depending on the format chosen. Defaults to true.

zopfli({ append: true });

threshold String|Number|Boolean

Minimum size required to compress a file. Defaults to false.

zopfli({ threshold: '1kb' });
zopfli({ threshold: 1024 }); // Values below 1 default to 1
zopfli({ threshold: true }); // Currently sets it to 150

zopfliOptions Object

Options object to pass through to node-zopfli. See node-zopfli documentation for more information.

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

Examples

const gulp = require('gulp');
const zopfli = require('gulp-zopfli-green');

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

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

Credit

This plugin is based on gulp-gzip.

Packages

No packages published

Languages

  • JavaScript 98.2%
  • Makefile 1.8%