gulp-mmtrix
Advanced tools
Comparing version 0.1.5 to 0.1.6
10
index.js
@@ -29,3 +29,3 @@ var through = require('through2'); | ||
// Plugin level function (dealing with files) | ||
function gulpPrefixer(options) { | ||
function gulpPrefixer(options, eventCall) { | ||
@@ -58,6 +58,9 @@ var accesskey = options.accesskey, | ||
mmtrix(reqOpt, file, ((data) => { | ||
mmtrix(reqOpt, file, ((data, responseJson) => { | ||
gutil.log(PLUGIN_NAME + ': [compressing]', gutil.colors.green('✔ ') + file.relative + gutil.colors.gray(' (done)')); | ||
file.contents = data; | ||
this.push(file); | ||
if(eventCall) { | ||
eventCall(responseJson); | ||
} | ||
return callback(); | ||
@@ -90,4 +93,5 @@ }).bind(this) ); | ||
var filename = file.relative; | ||
// gutil.log(PLUGIN_NAME, body, gutil.colors.green('now download'));2 | ||
download(minurl, filename, (buf) => { | ||
cb(buf); | ||
cb(buf, body); | ||
}); | ||
@@ -94,0 +98,0 @@ } |
{ | ||
"name": "gulp-mmtrix", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "a gulp plugin for mmtrix who used to compress image", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -22,3 +22,5 @@ ## gulp-mmtrix | ||
gulp.src('your/minify/img/**') | ||
.pipe(mmtrix(opt)) | ||
.pipe(mmtrix(opt, function(data){ | ||
console.log(data) | ||
})) | ||
.pipe(gulp.dest('/imagemin/')) | ||
@@ -30,1 +32,3 @@ }) | ||
`accesskey` and `securekey` is generate by [mmtrix](http://doc.mmtrix.com/api/imageopt.html) | ||
`data` is the response from [mmtrix](http://doc.mmtrix.com/api/imageopt.html) |
4947
89
32