0.1.1 • Published 5 years ago
gulp-into-base64 v0.1.1
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'));