Tuesday, 9 April 2019

How to manipulate by relative output path of Vinyl file inside gulp pipeline?

In the below gulp task, targetFile.relative (property of Vinyl instance) will bee concatenated to dest path. For example if targetFile.relative is images/icons/HamburgerMenu__Icon.svg, output path will be <Project absolute path>/dest/images/icons/HamburgerMenu__Icon.svg

gulp.src('source/singletonComponents/**/*.+(png|jpg|gif|svg)')
    .pipe(gulp.dest( targetVinylFile => {          
      return 'dest'
    }));

What if we want to change targetFile.relative? For example, we want to output to dest/pictures/icons/HamburgerMenu__Icon.svg, but we don't want to rename source forlder images to pictures.

Because in this question we are considering the output path manipulation, please, not not touch source files/directories, and also 'source/singletonComponents/**/*.+(png|jpg|gif|svg)' in solutions.

And also: it you think that it's not possible, please answer such as.



from How to manipulate by relative output path of Vinyl file inside gulp pipeline?

No comments:

Post a Comment