google / ioweb2015

I/O Web App 2015
https://events.google.com/io2015/
Apache License 2.0
687 stars 122 forks source link

gulp.src(): use {read: false} where appropriate to speed up builds #656

Open ebidel opened 9 years ago

ebidel commented 9 years ago

When we don't need to read the contents of the file (e.g. just get a list). This could speed things up a bit.

https://github.com/gulpjs/gulp/blob/master/docs/API.md#optionsread

x1ddos commented 9 years ago

I looked at gulpfile but it seems gulp.src() is always used to read the files, at least to copy them with gulp.dest().

Is looking into gulp plugins code the only way to find out whether it actually reads the files?

ebidel commented 9 years ago

gulp.src() reads the file contents for copying?

x1ddos commented 9 years ago

gulp.src() uses vinyl-fs.src() which reads the files into an in-memory stream unless options.read = false.

You can then "pipe" it into another stream. It could be gulp.dest() which writes that stream back to the storage. So gulp.dest() definitely needs file content, but so does $.sass() and other plugins.

What I'm saying is, I'm not sure how to rule out functions/plugins that don't actually need file contents.