gulp-spritesmith
gulp-spritesmith copied to clipboard
TypeError: Cannot read property 'height' of undefined
const gulp = require('gulp');
const spritesmith = require('gulp-spritesmith');
const gulpif = require('gulp-if');
gulp.task('sprites', () =>
gulp.src('img/sprites/*.png')
.pipe(spritesmith({
imgName: 'sprite.png',
styleName: 'sprite.css',
imgPath: '../img/sprite.png',
padding: 2
}))
.pipe(gulpif('*.png', gulp.dest('img/')))
.pipe(gulpif('*.css', gulp.dest('_src/scss/vendor/')))
);
With bunch of random png files get the error message:
(node:54909) DeprecationWarning: 'GLOBAL' is deprecated, use 'global'
[13:03:10] Starting 'sprites'...
/Users/dzmvasilevsky/Work/Sites/!!!BASE TEMPLATE/node_modules/gmsmith/lib/gmsmith.js:149
'height': size.height,
^
TypeError: Cannot read property 'height' of undefined
at saveImgSize (/Users/dzmvasilevsky/Work/Sites/!!!BASE TEMPLATE/node_modules/gmsmith/lib/gmsmith.js:149:23)
at fn (/Users/dzmvasilevsky/Work/Sites/!!!BASE TEMPLATE/node_modules/gmsmith/node_modules/async/lib/async.js:582:34)
at Immediate.<anonymous> (/Users/dzmvasilevsky/Work/Sites/!!!BASE TEMPLATE/node_modules/gmsmith/node_modules/async/lib/async.js:498:34)
at runCallback (timers.js:651:20)
at tryOnImmediate (timers.js:624:5)
at processImmediate [as _immediateCallback] (timers.js:596:5)