Closed brendanfalkowski closed 5 years ago
The only context affected by swapping techniques is when running gulp image
then gulp image
again. This is uncommon during dev, but is superior when using the gulp-changed
package no images are processed the second time.
Other contexts like running gulp
and gulp watch
behave the same because these internally trigger gulp clean
first which forces all images to be processed. This is the routine used 99.9% of the time during development.
So, using gulp.lastRun()
is a good simplification that reduces packages.
I will remove the gulp-changed
package.
@phated thanks for the tip here: https://github.com/gravitydepartment/frontend-starter/pull/2#issuecomment-473453195
Note to self: using neither technique is not a good approach.
Running gulp image
multiple times, or adding an image with a watcher always causes all images to be processed (not good).
Background
Evaluate if the
gulp-changed
package can be replaced by the Gulp 4 functiongulp.lastRun()
.In this repo,
gulp-changed
was used to speed up builds by avoiding reprocessing all images on subsequent runs.If
gulp.lastRun()
can do equivalent work without adding a package dependency then we'll use the Gulp-native feature.Evaluation scenarios
Old code — using
gulp-changed
packageSee: https://www.npmjs.com/package/gulp-changed
Test — Run
gulp watch
, then add one image file ✅ All images processed, then one image processedTest — Run
gulp image
, then rungulp image
✅ All images processed, then no images processedNew code — using
gulp.lastRun()
See: https://gulpjs.com/docs/en/api/lastrun
Test — Run
gulp watch
, then add one image file ✅ All images processed, then one image processedTest — Run
gulp image
, then rungulp image
❌ All images processed, then all images processed