gulp-html缩小错误



在gump中尝试在构建中执行html缩小

代码:

gulp.task('html',function(){
  return gulp.src('app/**/*.html')
   .pipe($.useref.assets({searchPath: '{.tmp,app}'}))
   // Concatenate And Minify JavaScript
    .pipe($.if('*.js', $.uglify({
     preserveComments: 'some'
    })))
    // Concatenate And Minify Styles
    .pipe($.if('*.css', $.csso()))
    .pipe($.useref.restore())
    .pipe($.useref())
    // Update Production Style Guide Paths
    .pipe($.replace('styles/main.css'))
    // Minify Any HTML Output Files
    .pipe(gulp.dest'dist'))
    .pipe($.size({title: 'html'}));
});

错误:

TypeError: Uncaught, unspecified "error" event.
    at TypeError (<anonymous>)
    at Transform.emit (events.js:74:15)
    at Transform.onerror (node_modulesgulpnode_modulesvinyl-fsnode_modulesthrough2node_modulesreadable-streamlib_stream_readable.js:558:12)
    at Transform.emit (events.js:95:17)
    at Transform.<anonymous> (index.js:80:42)
    at Array.forEach (native)
    at Transform.<anonymous> (index.js:68:35)
    at Array.for Each (native)
    at Transform.<anonymous> (index.js:46:36)
    at Array.forEach (native)

有人遇到这个问题吗,请建议如何修复这个

谢谢Sundar

升级gulp-useref:

npm remove gulp-useref && npm i gulp-useref --save-dev

相关内容

  • 没有找到相关文章

最新更新