Gzip SVG vector graphics files with Gulp
  • JavaScript 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2017-01-12 14:05:02 -06:00
.gitignore init commit 2016-04-29 11:19:19 -05:00
index.js fix broken compress 2017-01-12 14:05:02 -06:00
LICENSE init commit 2016-04-29 11:19:19 -05:00
package.json fix broken compress 2017-01-12 14:05:02 -06:00
README.md readme 2016-04-29 14:14:44 -05:00

gulp-svg2z

Gzip SVG vector graphics files with Gulp

Will pass-through any non-svg files unaltered so you can use in conjuction with other image optimzation tools if you don't want a separate task for different file formats.

Install

$ npm install --save-dev gulp-svg2z

Usage

var gulp = require('gulp'),
    svg2z = require('gulp-svg2z');

gulp.task('default', function() {

    gulp.src('src/img/*')
        .pipe(svg2z())
        .pipe(gulp.dest('dest/img'));
});

Options

Options are passed directly to zlib. Details can be found here.

Only default is compression level set to max. {level: 9}

Extra Credit

For extra (very small) savings on file size, use in conjuction with gulp-svgo (or any other svgo optimization). If every byte counts, this is an easy way to up the savings, but be aware that this probably wont make a huge impact on your compression.

Example

var gulp = require('gulp'),
    svgo = require('gulp-svgo'),
    svg2z = require('gulp-svg2z');

gulp.task('default', function() {

    gulp.src('src/img/*')
        .pipe(svgo())
        .pipe(svg2z())
        .pipe(gulp.dest('dest/img'));
});