Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gulp.src('xxx', {since: gulp.lastRun('xxx')}) issue #1097

Closed
SEIAROTg opened this issue Jun 11, 2015 · 7 comments
Closed

gulp.src('xxx', {since: gulp.lastRun('xxx')}) issue #1097

SEIAROTg opened this issue Jun 11, 2015 · 7 comments
Assignees

Comments

@SEIAROTg
Copy link

I have such a gulpfile.js:
var gulp = require('gulp');

gulp.task('build:public', function(cb){
    return gulp.src(['src/public/**/*'], {since: gulp.lastRun('build:public')})
        .pipe(gulp.dest('dist/public/'))
        .on('finish', cb);
});

gulp.task('watch:public', function(cb){
    return gulp.watch(['src/public/**/*'], gulp.series(['build:public']));
});

gulp.task('default', gulp.series(['build:public']));

However, when I executed gulp watch:public and changed a file, nothing happened.
Then I guess there may be a time error and changed {since: gulp.lastRun('build:public')} into {since: gulp.lastRun('build:public')-1}. But It still did't work. Then I tried {since: (gulp.lastRun('build:public')/1000-1)*1000}, which works for me.

Is this a bug? And if I want to implement Incremental building, do I have to use such trick?

I am working with Mac OS X 10.10.3, node v0.12.4, npm 2.10.1, gulp 4.0.0-alpha-1, gulp-cli 0.2.0

@phated
Copy link
Member

phated commented Jun 11, 2015

Do you think this is related to gulpjs/undertaker#26 ?

@yocontra
Copy link
Member

@SEIAROTg Nope you shouldn't have to do that, definitely a bug or mismatch

@yocontra yocontra added the bug label Jun 11, 2015
@SEIAROTg
Copy link
Author

@phated I think it's quite another problem, for it is not only the first calling that have my problem. I guess maybe it's because file timestamp is only accurate in seconds but not in milliseconds

@phated
Copy link
Member

phated commented Jun 11, 2015

@SEIAROTg we are capturing the "last-run" time before the task is run. That is the problem you are encountering. The issue I linked only mentions the first run but it is a problem for every run. See referenced PR on that issue. Also, please note that resolution is 1ms on node 0.11+ https://github.com/phated/default-resolution#default-resolutions

@phated phated added the gulp4 label Jun 11, 2015
@phated phated self-assigned this Jun 11, 2015
@phated
Copy link
Member

phated commented Jun 12, 2015

I've bumped undertaker to 0.11.1 with the fix for this. Can you please update your deps and try again?

@phated
Copy link
Member

phated commented Jun 12, 2015

Fix in gulpjs/undertaker@96540e3

@SEIAROTg
Copy link
Author

@phated It now works fine for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants