gulp-svgmin
Advanced tools
Comparing version 1.1.1 to 1.1.2
23
index.js
@@ -5,26 +5,27 @@ 'use strict'; | ||
SVGOptim = require('svgo'), | ||
gutil = require('gulp-util'); | ||
PluginError = require('gulp-util').PluginError, | ||
var PLUGIN_NAME = 'gulp-svgmin'; | ||
PLUGIN_NAME = 'gulp-svgmin'; | ||
module.exports = function(options) { | ||
module.exports = function (options) { | ||
var stream = new Transform({objectMode: true}); | ||
var svgo = new SVGOptim(options); | ||
stream._transform = function(file, unused, done) { | ||
stream._transform = function (file, encoding, cb) { | ||
if (file.isNull()) { | ||
return cb(null, file); | ||
} | ||
if (file.isStream()) { | ||
return done(new gutil.PluginError(PLUGIN_NAME, "Streaming not supported")); | ||
return cb(new PluginError(PLUGIN_NAME, 'Streaming not supported')); | ||
} | ||
if (file.isBuffer()) { | ||
svgo.optimize(String(file.contents), function(result) { | ||
svgo.optimize(String(file.contents), function (result) { | ||
if (result.error) { | ||
return done(new gutil.PluginError(PLUGIN_NAME, result.error)); | ||
return cb(new PluginError(PLUGIN_NAME, result.error)); | ||
} | ||
file.contents = new Buffer(result.data); | ||
done(null, file); | ||
cb(null, file); | ||
}); | ||
} else { | ||
// When null just pass through | ||
done(null, file); | ||
} | ||
@@ -31,0 +32,0 @@ }; |
{ | ||
"name": "gulp-svgmin", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Minify SVG files with gulp.", | ||
@@ -9,3 +9,3 @@ "license": "MIT", | ||
"name": "Ben Briggs", | ||
"email": "therealbenbriggs@hotmail.com", | ||
"email": "beneb.info@gmail.com", | ||
"url": "http://beneb.info" | ||
@@ -16,6 +16,3 @@ }, | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/ben-eb/gulp-svgmin.git" | ||
}, | ||
"repository": "ben-eb/gulp-svgmin", | ||
"keywords": [ | ||
@@ -26,15 +23,14 @@ "gulpplugin", | ||
"dependencies": { | ||
"gulp-util": "^3.0.2", | ||
"svgo": "^0.5.0" | ||
"gulp-util": "^3.0.4", | ||
"svgo": "^0.5.1" | ||
}, | ||
"devDependencies": { | ||
"chai": "~1.10.0", | ||
"gulp": "~3.8.10", | ||
"gulp-jshint": "~1.9.0", | ||
"gulp-mocha": "^2.0.0", | ||
"jshint-stylish": "~1.0.0", | ||
"mocha": "~2.1.0", | ||
"event-stream": "~3.2.1" | ||
"chai": "~2.2.0", | ||
"gulp": "~3.8.11", | ||
"gulp-jshint": "~1.10.0", | ||
"gulp-mocha": "^2.0.1", | ||
"jshint-stylish": "~1.0.1", | ||
"mocha": "~2.2.1" | ||
}, | ||
"main": "index.js" | ||
} |
Sorry, the diff of this file is not supported yet
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
6
4810
1
Updatedgulp-util@^3.0.4
Updatedsvgo@^0.5.1