gulp-into-base64

0.1.1 • Public • Published

gulp-all-in-base64

  • 1、 基础功能

将CSS文件中的图片url转为base64.

    gulp.src(*.css)
        .pipe(base64({
            baseDir:'src/css',
            fileType: 'css',
            maxImageSize: 8*1024, // bytes
            debug: false
        }))
        .pipe(gulp.dest('build'));
  • 2、 进阶功能

自己配置正则表达式,将html、js等图片/MP3/字体转为base64.

  gulp.src(*.html)
      .pipe(base64({
          baseDir: 'src',
          fileType: 'html',
          maxImageSize: 8*1024, // bytes
          rule: /img\/(.*)\.(jpg|bmp|gif|ico|pcx|jpeg|tif|png|raw|tga)/g,
          debug: false
      }))
      .pipe(gulp.dest('build'));

Package Sidebar

Install

npm i gulp-into-base64

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

50.9 kB

Total Files

14

Last publish

Collaborators

  • chenronggui