The following example will parse the build blocks in the HTML, replace them and pass those files through. Assets inside the build blocks will be concatenated and passed through in a stream as well.
var gulp = require('gulp'),
useref = require('gulp-useref');
gulp.task('default', function () {
return gulp.src('app/*.html')
.pipe(useref()) //有没有这句话似乎没什么影响
.pipe(gulp.dest('dist'));
});
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
它可以把html里零碎的这些引入合并成一个文件,但是它不负责代码压缩。
An example of this in completed form can be seen below:
The resulting HTML would be:
这个插件创建的文档,要注意文档编码格式。