This plugin converts a set of images to base64 encoded datauris and combines them in a single json file.
Note: This is a demo of a gulp plugin and not published to any public repository.
const convert = require('./index.js');
gulp.task('convert', function() {
return gulp.src('./images/*')
.pipe(convert('images.json'))
.pipe(gulp.dest('./tmp'));
});
Result images.json
{
"icon_sad.gif": "data:image/gif;base64...",
"icon_smile.gif": "data:image/gif;base64...",
"icon_wink.gif": "data:image/gif;base64..."
}
gulp test