0

Running my gulp task im getting the following error: SyntaxError: Unexpected token ; - im wondering what this relates to in terms of my Gulp task?

var gulp = require('gulp');
var sprite = require('gulp-sprite-generator');

gulp.task('sprites', function() {
    var spriteOutput;

    spriteOutput = gulp.src("src/css/*.css")
        .pipe(sprite({
            baseUrl:         "src/image/",
            spriteSheetName: "sprite.png",
            spriteSheetPath: "dist/image/"
        });

    spriteOutput.css.pipe(gulp.dest("dist/css/"));
    spriteOutput.img.pipe(gulp.dest("dist/image/"));
});

gulp.task('default', ['sprites']);

I've installed the two modules mentioned in the code. I have my gulp file in the root and also created the src baseUrl directories. In my css dir, I have one simple .css file with the following:

#image1 {
    background: url("../image/banana.png") no-repeat;
    width: 165px;
    height: 146px;
}

As reference this is the gulp-sprite-generator:

Complete error from console:

C:\FILE-PATH\gulp\gulp-sprite-generator>gulp

C:\FILE-PATH\gulp\gulp-sprite-generator\gulpf
ile.js:12
        });
          ^
SyntaxError: Unexpected token ;
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Liftoff.handleArguments (C:\NPM-PATH\Roaming\npm\node_modules\gu
lp\bin\gulp.js:116:3)
    at Liftoff.<anonymous> (C:\NPM-PATH\Roaming\npm\node_modules\gulp\n
ode_modules\liftoff\index.js:159:12)
    at module.exports (C:\NPM-PATH\Roaming\npm\node_modules\gulp\node_m
odules\liftoff\node_modules\flagged-respawn\index.js:17:3)
    at Liftoff.launch (C:\NPM-PATH\Roaming\npm\node_modules\gulp\node_m
odules\liftoff\index.js:152:5)
user1231561
  • 3,239
  • 6
  • 36
  • 55
  • You just have forgotten a `)` before the `;` : `spriteOutput = gulp.src("src/css/*.css") .pipe(sprite({ baseUrl: "src/image/", spriteSheetName: "sprite.png", spriteSheetPath: "dist/image/" }));` – Samuel Caillerie Nov 19 '14 at 13:12

1 Answers1

0

It looks like you are missing a closing ) on the following piece of code.

spriteOutput = gulp.src("src/css/*.css")
    .pipe(sprite({
        baseUrl:         "src/image/",
        spriteSheetName: "sprite.png",
        spriteSheetPath: "dist/image/"
    }));

That should sort out that error.

Marc Harry
  • 2,410
  • 19
  • 21