zoukankan      html  css  js  c++  java
  • gulp-htmlone的BUG弃坑

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

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

    如下:/src/common/images/i_banner.jpg会被改成srccommonimagesi_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)
  • 相关阅读:
    结对编程作业
    4组-Alpha冲刺-2/6
    4组-Alpha冲刺-1/6
    结对编程作业
    4组 团队展示
    python多进程遇到的问题和解决
    GNS3第一次ping通
    前缀表达式计算(栈的使用)
    欧拉筛法(线性筛)素数
    拓扑排序
  • 原文地址:https://www.cnblogs.com/lichuntian/p/8004487.html
Copyright © 2011-2022 走看看