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 does not update 'date modified' of dist-directory after changes in partials - (zurb-advanced-template) #8544

Closed
FynnZW opened this issue Apr 7, 2016 · 15 comments

Comments

@FynnZW
Copy link

FynnZW commented Apr 7, 2016

I've got a rather specific bug and it might actually be a bug from gulp, not foundation. But in any case, it would be great to have a workaround.
My Setup:

  • Foundation 6.2.0 (advanced template)
  • foundation-cli@2.1.0
  • OSX

I ran npm install and npm update , too.

How can we reproduce this bug?

  1. Start foundation watch in a zurb template, edit any _partial.scss from the src/scss/components-directory
  2. Alternatively, edit anything in the default.html in src/layouts

What did you expect to happen?

  1. The "date modified" of the app.css updates in dist
  2. All html-files update their "date modified" in dist, since their header and footer were updated by altering the default.html in src

What happened instead?

  1. The app.css keeps the date of the original app.scss in src, regardless in changes in any imported scss-partials. To force an update , it is necessary to make any change in app.scss (like opening it, add a space anywhere, and save).
  2. The "date modified" of individual html-files in dist do not get updated when you make any changes in the default.html in src.

I remember that before updating to 6.2 and gulp#4.0, all files in dist got a new "date modified". I think it's great that this does not happen anymore, only changed files get updated.
The problem is just that imports like scss-partials or the panini-layout are not registered as changes.

I no expert in gulp, but it seems to be connected to gulp-vinyl. I found these related discussions on gulp:
gulpjs/gulp#1414
gulpjs/gulp#1461
It seems it was resolved, though?:
gulpjs/vinyl#75
So I guess these bug reports were about the an older bug not updating the date at all, and not about not noticing imported changes.

Edit , here's the package.json:

{
  "name": "foundation-zurb-template",
  "version": "1.0.0",
  "description": "Official ZURB Template for Foundation for Sites.",
  "main": "gulpfile.js",
  "scripts": {
    "start": "gulp",
    "build": "gulp build --production"
  },
  "author": "ZURB <foundation@zurb.com>",
  "license": "MIT",
  "devDependencies": {
    "babel-core": "^6.3.17",
    "babel-plugin-transform-es2015-arrow-functions": "^6.5.2",
    "babel-plugin-transform-es2015-block-scoped-functions": "^6.5.0",
    "babel-plugin-transform-es2015-block-scoping": "^6.5.0",
    "babel-plugin-transform-es2015-classes": "^6.5.2",
    "babel-plugin-transform-es2015-destructuring": "^6.5.0",
    "babel-plugin-transform-es2015-modules-commonjs": "^6.5.2",
    "babel-plugin-transform-es2015-parameters": "^6.5.0",
    "babel-plugin-transform-es2015-shorthand-properties": "^6.5.0",
    "babel-plugin-transform-es2015-spread": "^6.5.2",
    "babel-plugin-transform-es2015-template-literals": "^6.5.2",
    "babel-preset-es2015": "^6.3.13",
    "browser-sync": "^2.10.0",
    "gulp": "gulpjs/gulp#4.0",
    "gulp-autoprefixer": "^3.1.0",
    "gulp-babel": "^6.1.2",
    "gulp-cli": "gulpjs/gulp-cli#4.0",
    "gulp-concat": "^2.5.2",
    "gulp-cssnano": "^2.1.0",
    "gulp-extname": "^0.2.0",
    "gulp-if": "^2.0.0",
    "gulp-imagemin": "^2.2.1",
    "gulp-load-plugins": "^1.1.0",
    "gulp-sass": "^2.1.0",
    "gulp-sourcemaps": "^1.6.0",
    "gulp-uglify": "^1.2.0",
    "gulp-uncss": "^1.0.1",
    "js-yaml": "^3.4.6",
    "panini": "^1.3.0",
    "rimraf": "^2.4.3",
    "style-sherpa": "^1.0.0",
    "yargs": "^3.8.0"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/zurb/foundation-zurb-template.git"
  },
  "bugs": {
    "url": "https://github.com/zurb/foundation-sites/issues",
    "email": "foundation@zurb.com"
  },
  "private": true
}
@FynnZW FynnZW changed the title Gulp does not update 'date modified' of dist-directory in some cases - (zurb-advaced-template) Gulp does not update 'date modified' of dist-directory after changes in partials - (zurb-advanced-template) Apr 7, 2016
@FynnZW
Copy link
Author

FynnZW commented May 17, 2016

My workaround at the moment is using this additional gulp-plugin:
https://www.npmjs.com/package/gulp-touch
npm install --save-dev gulp-touch
and then calling it before the browser-reload:


// Compile Sass into CSS
// In production, the CSS is compressed
function sass() {
  return gulp.src('src/assets/scss/app.scss')
    .pipe($.sourcemaps.init())
    .pipe($.sass({
      includePaths: PATHS.sass
    })
      .on('error', $.sass.logError))
    .pipe($.autoprefixer({
      browsers: COMPATIBILITY
    }))
    //.pipe($.if(PRODUCTION, $.uncss(UNCSS_OPTIONS)))
    .pipe($.if(PRODUCTION, $.cssnano()))
    .pipe($.sourcemaps.write('.'))
    .pipe(gulp.dest(PATHS.dist + '/assets/css'))
    // ****** touch-plugin here ****
    .pipe($.touch())
    .pipe(browser.reload({ stream: true }));
}

@billyromano
Copy link

The gulp-touch plugin works like a charm. I'm surprised gulp has this type of issue still to this day. It's been frustrating with a recent project between .NET and Front End devs.

@DanielRuf
Copy link
Contributor

gulp-touch is also what we use in production. This is a known (config) issue in Gulp.

@DanielRuf
Copy link
Contributor

Should we implement gulp-touch for now? When we switch to a full webpack build we will not have this issue anymore.

@DanielRuf DanielRuf self-assigned this Mar 10, 2018
@DanielRuf DanielRuf removed the 🐛bug label Mar 10, 2018
@DanielRuf
Copy link
Contributor

DanielRuf commented Mar 12, 2018

How should we decide on this @ncoden? In our projects we use sometimes gulp-touch but our CMS has cache busting integrated in the deployment process so we do not need this in most cases.

I think this should be part of (one of) the templates, not the framework itself.

@DanielRuf
Copy link
Contributor

@ncoden what should we do here?

@JessDelAngel
Copy link

JessDelAngel commented Mar 8, 2019

I can't install the gulp-touch plugin. I get this error:

npm ERR! code ETARGET npm ERR! notarget No matching version found for har-validator@5.1.2 npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a package version that doesn't exist. npm ERR! notarget npm ERR! notarget It was specified as a dependency of 'foundation-zurb-template' npm ERR! notarget

I don't know how to solve this. Can someone help me please?

@DanielRuf
Copy link
Contributor

Hi @JessDelAngel,

this is a different issue. Did you already try to delete the lockfile and install it again?

@JessDelAngel
Copy link

Hi @DanielRuf, thank you so much for the quick response. Where can I find the lockfile? (I'm sorry, but I don't know much about this kind of things)

@DanielRuf
Copy link
Contributor

Try rm package-lock.json or manually delete the package-lock.json file.

@JessDelAngel
Copy link

Thank you so much @DanielRuf!

@DanielRuf
Copy link
Contributor

Did this solve your issue @JessDelAngel?

@JessDelAngel
Copy link

Yes, it did! Thanks @DanielRuf :)

@DanielRuf
Copy link
Contributor

Also see ahmadnassri/node-har-validator#112 (comment) and ahmadnassri/node-har-validator#113 why the version was not found anymore.

The author unpublished two versions without a good reason.

@DanielRuf
Copy link
Contributor

So far we did not receive fue'rther reports.

I close this issue for now. It is probably fixed in gulp.

Please let us know if this is not the case for you.

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

6 participants