Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pedra/gulp-img2b64
Converter from an image file stream (Gulp) to base64
https://github.com/pedra/gulp-img2b64
Last synced: 16 days ago
JSON representation
Converter from an image file stream (Gulp) to base64
- Host: GitHub
- URL: https://github.com/pedra/gulp-img2b64
- Owner: pedra
- License: mit
- Created: 2021-06-09T02:19:22.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-06-09T04:45:02.000Z (over 3 years ago)
- Last Synced: 2024-10-16T02:32:39.370Z (4 months ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gulp-img2b64
This is a simple **Gulp** plugin to convert from an **image** file stream **to base64**.
## Install
Install as a "devDependencies" in your project:
```node
$ npm i -D gulp-img2b64
```## Usage
This is an example of gulpfile.js.
```javascript
const gulp = require('gulp')
const b64 = require('gulp-img2b64')const image = () =>
src('src/img/*')
.pipe(b64())
.pipe(dest('public/img'))
```
- [x] Takes all compatible images (jpg, jpeg or png) from "./src/img" directory;
- [x] Convert to base64 (data URL);
- [x] Saves in "./public/img" with the original names changing the extension to ".b64".*### Chained
Use with **another** plugin for better image optimization:```javascript
const gulp = require('gulp')
const b64 = require('gulp-img2b64')
const imagemin = require('gulp-imagemin')const image = () =>
src('src/img/*')
.pipe(imagemin())
.pipe(b64())
.pipe(dest('public/img'))
```See how [gulp-imagemin](https://github.com/sindresorhus/gulp-imagemin) can help you.
## License
[MIT](https://mit-license.org) © [Bill Rocha](https://billrocha.netlify.com)