svg-sprite / gulp-svg-sprite

SVG sprites & stacks galore — Gulp plugin wrapping around svg-sprite that reads in a bunch of SVG files, optimizes them and creates SVG sprites and CSS resources in various flavours
MIT License
647 stars 43 forks source link

Type Error: Cannot read property 'length' of undefined #19

Closed chrisyeung1121 closed 9 years ago

chrisyeung1121 commented 9 years ago

I was trying out the library and it outputs this error on this task.


gulp.task('svgs', function() {
    gulp.src('svgs/*.svg')
        .pipe($.svgo())
        .pipe($.svgSprites({
            "mode": {
                "css": {
          "render": {
            "css": true
          }
                }
            }
        }))
        .pipe(gulp.dest('svgs'))
});

And the error log is here:


/Users/chrisyeung/cmd/playground/gulp/node_modules/gulp-svg-sprites/node_modules/svg-sprite-data/node_modules/css-selector-parser/lib/css-selector-parser.js:172
      l = str.length;
             ^
TypeError: Cannot read property 'length' of undefined
    at new exports.CssSelectorParser.ParseContext (/Users/chrisyeung/cmd/playground/gulp/node_modules/gulp-svg-sprites/node_modules/svg-sprite-data/node_modules/css-selector-parser/lib/css-selector-parser.js:172:14)
    at CssSelectorParser.exports.CssSelectorParser.CssSelectorParser.parse (/Users/chrisyeung/cmd/playground/gulp/node_modules/gulp-svg-sprites/node_modules/svg-sprite-data/node_modules/css-selector-parser/lib/css-selector-parser.js:474:17)
    at SVGObj.<anonymous> (/Users/chrisyeung/cmd/playground/gulp/node_modules/gulp-svg-sprites/node_modules/svg-sprite-data/lib/svg-obj.js:238:21)
    at Array.forEach (native)
    at SVGObj._replaceIDReferences (/Users/chrisyeung/cmd/playground/gulp/node_modules/gulp-svg-sprites/node_modules/svg-sprite-data/lib/svg-obj.js:235:9)
    at SVGObj.<anonymous> (/Users/chrisyeung/cmd/playground/gulp/node_modules/gulp-svg-sprites/node_modules/svg-sprite-data/lib/svg-obj.js:192:19)
    at Array.forEach (native)
    at SVGObj.namespaceIDs (/Users/chrisyeung/cmd/playground/gulp/node_modules/gulp-svg-sprites/node_modules/svg-sprite-data/lib/svg-obj.js:191:68)
    at /Users/chrisyeung/cmd/playground/gulp/node_modules/gulp-svg-sprites/node_modules/svg-sprite-data/lib/svg-sprite.js:395:21
    at fn (/Users/chrisyeung/cmd/playground/gulp/node_modules/gulp-svg-sprites/node_modules/svg-sprite-data/node_modules/async/lib/async.js:582:34)
    at Object._onImmediate (/Users/chrisyeung/cmd/playground/gulp/node_modules/gulp-svg-sprites/node_modules/svg-sprite-data/node_modules/async/lib/async.js:498:34)
    at processImmediate [as _immediateCallback] (timers.js:330:15)
jkphl commented 9 years ago

Hi @chrisyeung1121,

I'm sorry but you're posting this in the wrong repo. I guess you wanted to target @shakyShane's gulp-svg-sprites ... ;)

Cheers, Joschi

chrisyeung1121 commented 9 years ago

Thanks for letting me know. :P