Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var through = require('through2');
var gutil = require('gulp-util');
var PluginError = gutil.PluginError;
var PSD = require('psd');
function NoopPlugin(file, encoding, callback) {
if (file.isNull() || file.isDirectory()) {
return callback();
if (file.isStream()) {
this.emit('error', new PluginError({
plugin: 'PSD',
message: 'Streams are not supported.'
return callback();
if (file.isBuffer()) { (psd) {
return psd.image.saveAsPng('./tmp/output.png');
return callback();
function gulpPSD(){
return through.obj(NoopPlugin);
module.exports = gulpPSD;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment