S
S
Sergey2018-04-17 19:01:21
JavaScript
Sergey, 2018-04-17 19:01:21

Overwrite Gulp file?

There is a task that generates Sprites, but each time it is called, not only new pictures are added to the existing sprite, but in general everything that is in the folder (i.e. pictures are duplicated). How can I delete a sprite each time so that it is generated from scratch or somehow not duplicate pictures?

gulp.task('sprite', function () {
  	let spriteData = gulp.src('src/assets/img/sprite/*.*').pipe(spritesmith({
      imgName: 'sprite.png',
      imgPath: '../img/sprite/sprite.png',
      cssName: '../../css/sprite.scss',
      algorithm: 'binary-tree',
      padding: 5,
      cssFormat: 'scss'
  }));
  return spriteData.pipe(gulp.dest('src/assets/img/sprite/'));
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2018-04-17
@webinar

'src/assets/img/sprite/*.*'- that's why everyone is taken. Take only what you need

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question