gulp-htmlone的BUG弃坑

之前用项目用gulp-htmlone做最后的js和css内联打包出现各种问题

这次居然遇到打包后的css斜杠变反斜杠的问题

如下:/src/common/images/i_banner.jpg会被改成\src\common\images\i_banner.jpg

实在无法忍耐去改他的源码,改了后其他伙伴也要改,所以果断弃坑

在网上找了gulp-inline进行替代

gulp.task('inline', function() {
    gulp.src(['./pages/**/*.html'])
        .pipe(inline({
            js: uglify,
            css: cssmin,
            disabledTypes: ['svg', 'img'] // Only inline css files 
          }))
        .pipe(gulp.dest('./dest'));
});

官方api如下:

https://www.npmjs.com/package/gulp-inline

Plugin options:

  • base - the root directory containing the files to be inlined
  • css - css transform (gulp plugin)
  • js - js transform (gulp plugin)
  • svg - svg transform (gulp plugin)
  • ignore - array of file paths to ignore and not inline (file paths as they appear in the source)
  • disabledTypes - array of types not to run inlining operations on (css, svg, js, img)
posted @ 2017-12-08 11:12  me春天  阅读(367)  评论(0编辑  收藏  举报