Last active
December 4, 2015 18:54
-
-
Save shaneparsons/7a9563f377754b3a07e3 to your computer and use it in GitHub Desktop.
laravel-elixir-imagemin - minify images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var Elixir = require('laravel-elixir'); | |
var changed = require('gulp-changed'); | |
var imagemin = require('gulp-imagemin'); | |
var pngquant = require('imagemin-pngquant'); | |
var Task = Elixir.Task; | |
Elixir.extend('images', function (src, output) { | |
new Task('images', function () { | |
return gulp.src(src) | |
.pipe(changed(output)) | |
.pipe(imagemin({ | |
progressive: true, | |
svgoPlugins: [ | |
{cleanupIDs: false}, | |
{cleanupNumericValues: false}, | |
{convertShapeToPath: false}, | |
{mergePaths: false}, | |
{removeUnknownsAndDefaults: false}, | |
{removeViewBox: false}, | |
], | |
use: [pngquant()] | |
})) | |
.pipe(gulp.dest(output)) | |
.pipe(new Elixir.Notification('Images Minified!')); | |
}) | |
.watch(src); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment