1. In the process of using gulp-useref, the file merging was successful, but why the html file I generated was cut
return gulp.src("./bulid/result-1.html")
.pipe($.debug())
.pipe($.useref({},lazypipe().pipe($.sourcemaps.init)))
.pipe($.if("*.js",$.uglify()))
.pipe($.if("*.css",$.cleanCss()))
.pipe($.sourcemaps.write("/maps"))
.pipe(gulp.dest(dist))
}
this is a task I wrote myself to merge compressed files.
<!-- build:js js/result.min.js -->
<script src="js/result.js"></script>
<!-- endbulid -->
this is the merged js
<!-- build:css css/result.min.css -->
<link rel="stylesheet" type="text/css" href="css/result-1.css">
<!-- endbulid -->
this is the merged css
css compressed files and js compressed files can be generated normally. But the generated html file was cut. Why?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<script src="js/flex.js">
</script>
<title></title>
<link rel="stylesheet" href="css/result.min.css">
<script src="js/result.min.js"></script>
it is found that the rest of the content is gone. Only the compressed file path is left, and even the body and html tags at the end have disappeared