Skip to content

Commit

Permalink
add vinyl-fs opt
Browse files Browse the repository at this point in the history
  • Loading branch information
junmer committed May 5, 2016
1 parent 7af7798 commit 8456be3
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Fontmin.prototype.src = function (file) {
return this._src;
}

this._src = file;
this._src = arguments;
return this;
};

Expand All @@ -61,7 +61,7 @@ Fontmin.prototype.dest = function (dir) {
return this._dest;
}

this._dest = dir;
this._dest = arguments;
return this;
};

Expand Down Expand Up @@ -113,7 +113,9 @@ Fontmin.prototype.createStream = function () {
}

if (this.dest()) {
this.streams.push(vfs.dest(this.dest()));
this.streams.push(
vfs.dest.apply(vfs, this.dest())
);
}

return combine(this.streams);
Expand All @@ -126,20 +128,20 @@ Fontmin.prototype.createStream = function () {
* @api private
*/
Fontmin.prototype.getFiles = function () {
if (Buffer.isBuffer(this.src())) {
return bufferToVinyl.stream(this.src());

if (Buffer.isBuffer(this._src[0])) {
return bufferToVinyl.stream(this._src[0]);
}

return vfs.src(this.src());
return vfs.src.apply(vfs, this.src());
};

/**
* Module exports
* plugins
*
* @type {Array}
*/
module.exports = Fontmin;

// export pkged plugins
[
Fontmin.plugins = [
'glyph',
'ttf2eot',
'ttf2woff',
Expand All @@ -148,10 +150,18 @@ module.exports = Fontmin;
'svg2ttf',
'svgs2ttf',
'otf2ttf'
].forEach(function (plugin) {
module.exports[plugin] = require('./plugins/' + plugin);
];

// export pkged plugins
Fontmin.plugins.forEach(function (plugin) {
Fontmin[plugin] = require('./plugins/' + plugin);
});

/**
* Module exports
*/
module.exports = Fontmin;

// exports util, mime
module.exports.util = exports.util = require('./lib/util');
module.exports.mime = exports.mime = require('./lib/mime-types');

0 comments on commit 8456be3

Please sign in to comment.