Not updating modified timestamp of output when working with @import
See original GitHub issuegulp-sass does not seem to update the modified date of the generated .css file, instead it uses the same date as the input .scss file.
This leads to problems when using gulp-sass together with rails/sprockets. If I update .scss files that are imported into a global.scss, the created css file will still use the same modified timestamp as the global.scss and sprockets will not load the new file.
In order to fix this, I had to manually update the modified time after gulp-sass:
var touch = require('gulp-touch-cmd');
return gulp.src(config.src)
.pipe(sass(config.settings))
.pipe(gulp.dest(config.dest))
.pipe(touch()) /* fix to update modified time */
Tested with versions 2.0.4
and 4.0.1
.
Gulp 4.0.0
I’m not sure if this is a problem of gulp-sass or gulp itself.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:6 (4 by maintainers)
Top Results From Across the Web
File modified timestamp not updating... - TechNet - Microsoft
Our business application generates a log file every minute but the issue is the datemodified timestamp is not gets updated automatically.
Read more >Timestamp in MySQL not updating despite updating records
The main reason that your timestamp is not updating beacuse you have not added ON UPDATE CURRENT_TIMESTAMP clause in your table creation statement....
Read more >python timestamp doesn't update - Ask Ubuntu
ctime() is not changing when executing my program each 5 second. How can I fix it? My program: import random import time n...
Read more >File last modified date not updating for certain file types
Through testing I found the issue is different for different file types. The test was simply to rewrite each file to contain only...
Read more >Column INSERT/UPDATE Defaults
That is, if a table has a column called “timestamp”, and an INSERT statement proceeds which does not include a value for this...
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
In the meantime, if anyone needs the output file to have an updated modified/accessed time, you can pipe this before the gulp.dest pipe (requires you add through2)
I hope you reconsider.
This plugin is responsible for the compiled css file, and that file that is compiled from it is reporting the wrong modified time. It’s a bug.
https://github.com/dlmanning/gulp-sass/blob/master/index.js#L99 When you are assigning
file.contents
andfile.path
, you should just setfile.mtime = new Date();
or some such.EDIT:
file.stat.mtime = new Date();