D
D
denis26012018-08-25 18:35:08
Node.js
denis2601, 2018-08-25 18:35:08

Why is the gulp-changed plugin not working?

The project structure is as follows:

dist
  - css
  - js
  - vendor
src
  - components
    - index
      - template
        - include_file_1.html
        - include_file_2.html

      - index.html
    - alerts
    - team
    - ...
  - js
  - scss

Building html files:
var gulp = require('gulp'),
    changed = require('gulp-changed'),
    fileInclude = require('gulp-file-include');

    gulp.task('html', function () {
      gulp.src('src/components/**/index.html')
        .pipe(changed('dist', {hasChanged: changed.compareSha1Digest}))
        .pipe(fileInclude())
        .pipe(gulp.dest('dist'))
    });

The fact is that when assembling files, everything is collected, but it is necessary that only the one that was changed (1) is collected, and of course those files that include includes (2) are rebuilt. I read on the forums, and they write that the gulp-changed plugin can track such files (2), and even if it were only rebuilt (1), there would be no reaction at all, it would compile everything.
What am I doing wrong, tell me?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2018-08-25
@delphinpro

Use gulp-changedfor binary files
and gulp-changed-in-placefor text
files Well, the plugin needs to be inserted after assembly. You check the hash of a file that has not yet been processed (without includes), of course it will differ from the processed one.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question