akoenig / gulp-svg2png

A gulp plugin for converting SVGs to PNGs.
MIT License
54 stars 34 forks source link

Unable to load the source file #10

Open samdbeckham opened 9 years ago

samdbeckham commented 9 years ago

I'm getting the following error whenever I try to pipe an SVG sprite into svg2png.

throw new gutil.PluginError(PLUGIN_NAME, message);
              ^
Error: Error while converting image.Error: Unable to load the source file.
    at error (/Users/.../node_modules/gulp-svg2png/index.js:59:15)
    at converted (/Users/.../node_modules/gulp-svg2png/index.js:160:24)
    at /Users/.../node_modules/gulp-svg2png/node_modules/svg2png/lib/svg2png.js:20:13
    at ChildProcess.exithandler (child_process.js:742:7)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Socket.<anonymous> (child_process.js:1183:11)
    at Socket.emit (events.js:107:17)
    at Pipe.close (net.js:485:12)

I used gulp-print to see if the SVG was being passed through correctly and everything seems to be passing through fine.

[18:22:20] Starting 'generate-svg-icon-sprite'...
[gulp] svg/icon-sprite.svg

Here's the gulp task in all it's glory (I'm using gulp-svgsprite to generate the sprite):

gulp.task('generate-svg-icon-sprite', function() {
    return gulp.src(paths.icons.raw + 'svg/*.svg') 
        .pipe(svgSprite({
            mode: {
                symbol: {
                    dest: 'svg',
                    sprite: 'icon-sprite',
                }   
            }   
        })) 
        .pipe(print())
        .pipe(svg2png())
        .pipe(gulp.dest(paths.icons.dest));
});
akoenig commented 9 years ago

Thanks for reporting, @samdbeckham. - I guess this problem is related to the fact that the plugin does not support streams at the moment.

Have to develop a possible implementation strategy for that case.