@mohuk/gulp-image64

1.0.1 • Public • Published

gulp-image64

NPM version Build Status Dependencies

Convert and replace image-files within your DOM/HTML to base64-encoded data.

Example

gulpfile.js
var gulp = require('gulp');
var image64 = require('gulp-image64');

//cheerio load options
var options = {
	lowerCaseAttributeNames: false
};

gulp.task('default', function () {
	gulp.src('index.html')
		.pipe(image64(options))
		.pipe(gulp.dest('path'));
});
index.html // Before...
<html>
	<head>
	</head>
	<body>
		<img src="sample.png" />
...
path/index.html // ...after:
<html>
	<head>
	</head>
	<body>
		<img src="data:image/png;base64,...">

...

This plugin uses cheerio so any options passed in image64(options) function call will be passed into cheerio.load function. See here for complete list of options.

Dependents (0)

Package Sidebar

Install

npm i @mohuk/gulp-image64

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • mohuk