https://github.com/pfan123/gulp-to-base64
https://github.com/pfan123/gulp-to-base64
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/pfan123/gulp-to-base64
- Owner: pfan123
- Created: 2016-04-07T07:39:59.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-12T06:02:37.000Z (over 8 years ago)
- Last Synced: 2025-01-10T02:55:01.338Z (4 months ago)
- Language: HTML
- Size: 11.5 MB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gulp-to-base64 [](https://www.npmjs.com/package/gulp-to-base64)
A simple gulp plugin, used to convert image(png|jpg|gif),audio(mp3|m4a|ogg|wav|wma),video(mp4|webm), font(ttf|svg) into base64 string.
## Install
npm install gulp-to-base64
## Usage
```
var gulpBase64 = require("gulp-to-base64");
gulpBase64(options);
```## Example
```
var gulpBase64 = require("gulp-to-base64");
gulp.task('base64' , function(){
return gulp.src("./images/*.{png,jpg,jpeg,mp3,svg,ttf}")
.pipe(gulpBase64({
size: true // false by default , if true , write the width height
outPath:"./json.js" //output file path
}))
});
```## Generate Structures
If size is false```
{
file name : base64 encode
}
```to true
```
{
file name : {base64: base64 encode, width: xx, height: xx}, //image
file name : {base64: base64 encode} //xx.ttf,xx.svg,mp3,mp4
}
```## Interface Options
`outPath` is file path.