useref.assets 中断 gulp 管道
useref.assets break gulp pipeline
当我尝试在我的 index.html 文件上使用 gulp-useref 时,管道中断并且任务无法完成
有什么问题吗?
我的 html 来源上有 testet useref,它很好
gulp.task('html', function () {
var htmlFilter = $.filter(['*.html', '**/*.html']);
var cssFilter = $.filter('**/*.css');
var assets;
return gulp.src(
path.join(conf.paths.src, '*.html')
)
.pipe($.debug({title: 'after src:'}))
.pipe(assets = $.useref.assets())
.pipe($.debug({title: 'after useref.assets():'}))
.pipe($.rev())
.pipe(cssFilter)
.pipe($.minifyCss())
.pipe(cssFilter.restore())
.pipe(assets.restore())
.pipe($.useref())
.pipe($.revReplace())
.pipe(htmlFilter)
.pipe($.minifyHtml({
empty: true,
spare: true,
quotes: true,
conditionals: true
}))
.pipe(htmlFilter.restore())
.pipe(gulp.dest(path.join(conf.paths.dist, '/')))
.pipe($.size({ title: path.join(conf.paths.dist, '/'), showFiles: true }));
});
调试在 useref.assets
后不会显示
来自 gulp-useref github 页面:
Changes under the hood have made the code more efficient and simplified the API. Since the API has changed, please observe the usage examples below.
资产不再可用,所以我认为这是你的问题。
当我尝试在我的 index.html 文件上使用 gulp-useref 时,管道中断并且任务无法完成 有什么问题吗? 我的 html 来源上有 testet useref,它很好
gulp.task('html', function () {
var htmlFilter = $.filter(['*.html', '**/*.html']);
var cssFilter = $.filter('**/*.css');
var assets;
return gulp.src(
path.join(conf.paths.src, '*.html')
)
.pipe($.debug({title: 'after src:'}))
.pipe(assets = $.useref.assets())
.pipe($.debug({title: 'after useref.assets():'}))
.pipe($.rev())
.pipe(cssFilter)
.pipe($.minifyCss())
.pipe(cssFilter.restore())
.pipe(assets.restore())
.pipe($.useref())
.pipe($.revReplace())
.pipe(htmlFilter)
.pipe($.minifyHtml({
empty: true,
spare: true,
quotes: true,
conditionals: true
}))
.pipe(htmlFilter.restore())
.pipe(gulp.dest(path.join(conf.paths.dist, '/')))
.pipe($.size({ title: path.join(conf.paths.dist, '/'), showFiles: true }));
});
调试在 useref.assets
后不会显示来自 gulp-useref github 页面:
Changes under the hood have made the code more efficient and simplified the API. Since the API has changed, please observe the usage examples below.
资产不再可用,所以我认为这是你的问题。