码迷,mamicode.com
首页 > Web开发 > 详细

gulp-htmlone的BUG弃坑

时间:2017-12-08 13:58:38      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:file path   disabled   run   tran   www.   源码   option   app   path   

之前用项目用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)

gulp-htmlone的BUG弃坑

标签:file path   disabled   run   tran   www.   源码   option   app   path   

原文地址:http://www.cnblogs.com/lichuntian/p/8004487.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!