question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gulp 4 .watch() doesn't update file modified time

See original GitHub issue

What were you expecting to happen?

When I change and save partial scss file, gulp should update modified time of main scss file.

What actually happened?

css/
 ├ _external.scss
 └ main.scss
main.css
gulpfile.js

I edit and save _external.scss, created and updated main.css. But gulp doesn’t update modified time of main.css. When I change and save main.scss, gulp updates modified time of main.css.

In other words, gulp will not update modified time of main.css when I edit and save partial scss file. In this case, which is true, specifications or bugs?

Please post a sample of your gulpfile (preferably reduced to just the bit that’s not working)

var gulp = require('gulp');
var sass = require('gulp-sass');

gulp.task('style', function() {
  return gulp.src('css/main.scss')
    .pipe(sass())
    .pipe(gulp.dest('./'));
});

gulp.task('watch', function() {
  gulp.watch('css/**/*.scss', gulp.series('style'));
});

What version of gulp are you using?

4.0.0

What versions of npm and node are you using?

npm 6.1.0 node 8.9.3 10.5.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

20reactions
phatedcommented, Nov 4, 2018

Currently, this is a feature of gulp 4 due to a limitation of node’s fs.Stat object. If you need mtime to change - you need to modify the mtime on the files in your pipeline.

If you’d like to help work on a solution for this - we have an open issue at https://github.com/gulpjs/vinyl/issues/105

6reactions
takamosocommented, Apr 22, 2020

I’m using a gulp-touch-cmd plugin implemented in a similar way now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gulp v4 doesn't update the browser - Stack Overflow
The first time you run gulp.default you may need refresh the browser if you have some changes already made to your files.
Read more >
Watching Files | gulp.js
The watch() API connects globs to tasks using a file system watcher. It watches for changes to files that match the globs and...
Read more >
Gulp 4: A Sample Project - Shark Coder
Here is a simple guide on installing and configuring Gulp 4 for those who design a static web page which doesn't require backend...
Read more >
Browsersync + Gulp.js
Browsersync makes your browser testing workflow faster by synchronising URLs, interactions and code changes across multiple devices.
Read more >
Quick setup for Gulp 4 + Browsersync + Sass - Coder Coder
It works by spinning up a local server and syncing it up to your browser. Then, anytime you make a change in your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found