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 not updating timestamp of css file #14

Closed
starchild opened this issue Mar 21, 2019 · 5 comments
Closed

Gulp not updating timestamp of css file #14

starchild opened this issue Mar 21, 2019 · 5 comments

Comments

@starchild
Copy link

When the new style.css file is created using gulp, the time modified stamp remains untouched.

Ideally we would use this to version the css file but this is not possible without an updated date stamp.

Is this something that can be fixed in gulpfile.js?

@claudia-romano
Copy link
Contributor

Hi there, do you have an example of what you mean? Thanks

@starchild
Copy link
Author

Sure. I've made a bunch of changes to various _*.scss files, the latest of which was yesterday, and the style.css file gets compiled just fine.

However, the datestamp on the style.scss and style.css files remain at Mar 7.

You can see others talking about this same issue (which seems ot be an issue in gulp 4, but not 3) at gulpjs/gulp#2193 and a possible solution here: dlmanning/gulp-sass#706

@claudia-romano
Copy link
Contributor

Hi, thanks for the additional info.
I'm not sure we'll include this fix, as it seems to be an issue with gulp 4 only.
But here's a modified version of the sass task that should fix the issue:

var touch = require('gulp-touch-cmd'); // include this module as well
gulp.task('sass', function() {
  return gulp.src('main/assets/css/**/*.scss')
  .pipe(sass({outputStyle: 'expanded'}).on('error', sass.logError))
  .pipe(postcss([autoprefixer(), cssvariables({preserve: true}), calc()]))
  .pipe(gulp.dest('main/assets/css'))
  .pipe(touch())
  .pipe(browserSync.reload({
    stream: true
  }));
});

You'll need to install the gulp-touch-cmd module. I've tested it on masOS Mojave and seems to be fixing the issue.

@starchild
Copy link
Author

Fantastic thanks so much.

I've done this and it works a treat ;)

@S-n-d
Copy link

S-n-d commented Feb 14, 2020

Still running into this issue in 2020. Thanks for the tip @claudia-romano !

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

No branches or pull requests

3 participants