Multiple html files are executed gulp-useref cannot be referenced normally

  node.js, question

Just now, when I was doing the gulp-usere task, it appeared that not all js/css in html files can be correctly merged and applied. The test project was very simple. I wanted to merge and compress css/js of html inside in app directory into dest directory, and then the following results appeared:

clipboard.png

The following are the activity.html and activityList.html in the dest directory (still the same as in app, no change); It can be seen that activity.html can be correctly quoted, while activityList.html has just been copied, and so is another html file.

clipboard.png

clipboard.png

Only js/css in the activity.html file was normally compressed and referenced, while js/css in inside, the other two files, was normally compressed and merged without reference.

The task code is as follows:

gulp.task('useref',['clean:cssjs','clean:html'],function(){
 return gulp.src('app/MoxiWap/*.html')
 .pipe($.if('*.js',uglify()))
 .pipe($.if('*.css',cssnano()))
 .pipe(useref())
 .pipe(gulp.dest('dest'));
 })

I don’t know what the problem is.

According to the path of the landlord wrote it again-
The first is the two HTML in the DEV folder inside. The second HTML has exactly the same comments as the original owner’s
图片描述

However compile (my task name is HTML)
Gulp’s mission is as follows:

gulp.task('html', function() {
 return gulp
 .src('dev/*.html')
 .pipe(useref())
 .pipe(gulpif('*.js', uglify()))
 .pipe(gulpif('*.css', minifyCss()))
 .pipe(gulp.dest('dist'));
 });

After compilation, a new folder dist (publishing environment) is generated.
The MoxiWap folder and CSS/JS can be seen inside.
And the two HTML copies correctly replaced the reference
图片描述

According to the file provided by the landlord, I tested it-there is no problem, I will pack it and send it to you.

1. If this file I sent to you can run normally, then there is a problem with your node_modolue dependency.
2. If this is not the case. . That’s about computers-
Baidu Netdisk:http://pan.baidu.com/s/1eRKtFxC

The landlord himself deletes the dest folder in the outermost folder and then runs the gulp command-