Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PluginError is not defined #1

Closed
qhenkart opened this issue Sep 16, 2015 · 3 comments
Closed

PluginError is not defined #1

qhenkart opened this issue Sep 16, 2015 · 3 comments

Comments

@qhenkart
Copy link

I haven't had a problem in the past using gulp-unretina until just today, I randomly started getting this bug.

/gulp-unretina/index.js:29
return done(new PluginError(PLUGIN_NAME, err));
^
ReferenceError: PluginError is not defined
at gm. (/Users/qhenkart/workspace/launchpad/marketing/assets/node_modules/gulp-unretina/index.js:29:21)
at gm.emit (events.js:118:17)
at gm. (/Users/qhenkart/workspace/launchpad/marketing/assets/node_modules/gulp-unretina/node_modules/gm/lib/getters.js:70:16)
at Socket.cb (/Users/qhenkart/workspace/launchpad/marketing/assets/node_modules/gulp-unretina/node_modules/gm/lib/command.js:318:16)
at Socket.g (events.js:199:16)
at Socket.emit (events.js:107:17)
at onwriteError (_stream_writable.js:317:10)
at onwrite (_stream_writable.js:335:5)
at WritableState.onwrite (_stream_writable.js:105:5)
at fireErrorCallbacks (net.js:456:13)
at Socket._destroy (net.js:495:3)
at WriteWrap.afterWrite (net.js:777:10)

@ramonfritsch
Copy link
Owner

Hi there,

I just committed a fix for that. Have a look.
Also, it's firing because you're trying to use a stream as the input. It only works with files.

@qhenkart
Copy link
Author

@ramonfritsch Thank you so much for your expedient response and resolution. The PluginError was fixed but unfortunately it caused a new problem to arise. I wasn't sure if I should file a new issue or just comment on this one. Upon running Gulp Unretina, I now get this error:

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: write EPIPE
    at exports._errnoException (util.js:746:11)
    at WriteWrap.afterWrite (net.js:775:14)

I didn't write the gulp file, and the person who did is no longer working here. Strangely enough, we haven't had a problem running our gulp file exactly how it's written until yesterday.

I'm including the Gulp tasks that run unretina, both of which cause the same error independently.

gulp.task('sprites-unretina', ['sprites-clean'], function() {
        var tasks = util.getFolders(inputPath).map(function(folder) {
            return gulp.src(inputPath + folder + '/*2x*')
                .pipe(rename(function(filePath) {
                    filePath.basename = filePath.basename.replace(/(\-|\@)?2x/i, '');
                }))
                .pipe(unretina())
                .pipe(gulp.dest(inputPath + folder + '/1x/'));
        });

        return merge(tasks);
    });
 gulp.task('images-unretina', ['images-clean'], function() {
        var tasks = util.getFolders(inputPath).map(function(folder) {
            var imageData = {};

            return gulp.src(inputPath + folder + '/*2x*.@(png|jpg)')
                // create 2x urls for scss
                .pipe(foreach(function(stream, file) {
                    var imageName = path.basename(file.path, path.extname(file.path)).replace(/(\-|\@)?2x/i, '');

                    imageData[imageName] = {};
                    imageData[imageName].url2x = '#{$assets_path}/' + inputPath + folder + '/' + path.basename(file.path);

                    return stream;
                }))

                .pipe(rename(function(filePath) {
                    filePath.basename = filePath.basename.replace(/(\-|\@)?2x/i, '');
                }))
                .pipe(unretina())

                // create 1x urls for scss
                .pipe(foreach(function(stream, file) {
                    var imageName = path.basename(file.path, path.extname(file.path));

                    imageData[imageName].url = '#{$assets_path}/' + inputPath + folder + '/1x/' + path.basename(file.path);

                    return stream;
                }))

                .pipe(gulp.dest(outputPath + '/' + folder + '/1x'))
                .on('end', function() {
                    fs.writeFileSync(paths.scss + '/' + folder + '/_images.scss', template({items: imageData}));
                });
        });

        return merge(tasks);
    })

@ramonfritsch
Copy link
Owner

Hi there,

Never had this problem before. I did a quick test yesterday and everything
is running fine now.

Make sure you have imagemagick installed, that may be the cause.

On Thu, Sep 17, 2015 at 10:18 AM, Quest Henkart notifications@github.com
wrote:

@ramonfritsch https://github.com/ramonfritsch Thank you so much for
your expedient response and resolution. The PluginError was fixed but
unfortunately it caused a new problem to arise. I wasn't sure if I should
file a new issue or just comment on this one. Upon running Gulp Unretina, I
now get this error:

events.js:85
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at exports._errnoException (util.js:746:11)
at WriteWrap.afterWrite (net.js:775:14)

I didn't write the gulp file, and the person who did is no longer working
here. Strangely enough, we haven't had a problem running our gulp file
exactly how it's written until yesterday.

I'm including the Gulp tasks that run unretina, both of which cause the
same error independently.

gulp.task('sprites-unretina', ['sprites-clean'], function() {
var tasks = util.getFolders(inputPath).map(function(folder) {
return gulp.src(inputPath + folder + '/2x')
.pipe(rename(function(filePath) {
filePath.basename = filePath.basename.replace(/(-|@)?2x/i, '');
}))
.pipe(unretina())
.pipe(gulp.dest(inputPath + folder + '/1x/'));
});

    return merge(tasks);
});

gulp.task('images-unretina', ['images-clean'], function() {
var tasks = util.getFolders(inputPath).map(function(folder) {
var imageData = {};

        return gulp.src(inputPath + folder + '/*2x*.@(png|jpg)')
            // create 2x urls for scss
            .pipe(foreach(function(stream, file) {
                var imageName = path.basename(file.path, path.extname(file.path)).replace(/(\-|\@)?2x/i, '');

                imageData[imageName] = {};
                imageData[imageName].url2x = '#{$assets_path}/' + inputPath + folder + '/' + path.basename(file.path);

                return stream;
            }))

            .pipe(rename(function(filePath) {
                filePath.basename = filePath.basename.replace(/(\-|\@)?2x/i, '');
            }))
            .pipe(unretina())

            // create 1x urls for scss
            .pipe(foreach(function(stream, file) {
                var imageName = path.basename(file.path, path.extname(file.path));

                imageData[imageName].url = '#{$assets_path}/' + inputPath + folder + '/1x/' + path.basename(file.path);

                return stream;
            }))

            .pipe(gulp.dest(outputPath + '/' + folder + '/1x'))
            .on('end', function() {
                fs.writeFileSync(paths.scss + '/' + folder + '/_images.scss', template({items: imageData}));
            });
    });

    return merge(tasks);
})


Reply to this email directly or view it on GitHub
#1 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants