When using lastRun new files are skipped
See original GitHub issueWhat were you expecting to happen?
src should detect newly added files
What actually happened?
images task is running after new file is added, but nothing is copied to build, task is working properly only on changed files (for example changing the resolution of the image and save it). It also works on first run.
Please post a sample of your gulpfile (preferably reduced to just the bit that’s not working)
Example from documentation:
const { src, dest, lastRun, watch } = require('gulp');
const imagemin = require('gulp-imagemin');
function images() {
return src('src/images/**/*.jpg', { since: lastRun(images) })
.pipe(imagemin())
.pipe(dest('build/img/'));
}
function watch() {
watch('src/images/**/*.jpg', images);
}
exports.watch = watch;
What version of gulp are you using?
4
What versions of npm and node are you using?
6.5.0, 11.1.0
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How can I tell gulp to skip files it's already processed?
Use Gulp's lastRun() in combination with Gulp src 's option since() , no external dependencies needed. const gulp = require('gulp ...
Read more >dbms_scheduler.file_watch will only pull in files with t/s >= last ...
I am new to using the file_watcher in the dbms_scheduler so I ... WILL ONLY Pull files that are modified/created AFTER the last...
Read more >Mover reports - Migrate to Microsoft 365
Skipped files and folders When files and folders are "skipped," Mover has deliberately skipped that item during the transfer. Typically, items ...
Read more >Logstash skip records by adding latest updated record date in ...
Everything is working fine but I've stuck with :sql_last_value. ... records by adding latest updated record date in last run metadata file.
Read more >"Skip Duplicate Files" property enabled in Mass Ingestion ...
ERROR: "Skip Duplicate Files" property enabled in Mass Ingestion tasks does not process files failed in last run at target in IICS CDI ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@max-ci until now we’ve treated your use case as an edge case for last run because it’s variable whether someone desires a copied file to be passed through. We’ve actually had a discussion on this same issue previously at https://github.com/gulpjs/vinyl-fs/issues/226 without a resolution.
since
takes a function that receives each file and returns a timestamp, so you can also do custom logic if you’d like. If that solution doesn’t work for you, maybe the case is too specialized and you might need to reach for another module/plugin.@phated ideally should not
since
check bothmtime
andctime
(in order to cater newly created file through copy/paste)?