How would I exclude files from a stream if they exist in a destination. Or, alternatively, how do I tell gulp.dest()
not to overwrite files if they exist?
We use the through2 library as a wrapper for Node streams and create a log () function which outputs the filename of each processed file to the console. log () is called by Gulp for each file that it processes with three parameters. The first is a File object created by Vinyl and the third is a callback function.
Streams in Gulp provide us with a way to convert files into object that can flow through the pipeline without having to be written to disk after each step. The same workflow would look like this in Gulp:
The src () and dest () methods are exposed by gulp to interact with files on your computer. src () is given a glob to read from the file system and produces a Node stream. It locates all matching files and reads them into memory to pass through the stream.
Now we can use the log plugin in our Gulpfile to display the filename of each processed file alongside a label. We will add the log plugin before every plugin in our workflow to display the plugin name as label. This way we can see which plugin processes which files.
gulp-conflict
Check if files in stream conflict with those in target dir, with option to use new, keep old, show diff, etc.
https://www.npmjs.org/package/gulp-conflict/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With