https://github.com/marinerer/gulp-dataurl
A gulp plugin that converts matched file paths into base64-encoded data URI strings. gulp 插件, 将文件内所有匹配的url转换为base64编码.
https://github.com/marinerer/gulp-dataurl
base64 data-uri data-url gulp-base64 gulp-plugin
Last synced: about 2 months ago
JSON representation
A gulp plugin that converts matched file paths into base64-encoded data URI strings. gulp 插件, 将文件内所有匹配的url转换为base64编码.
- Host: GitHub
- URL: https://github.com/marinerer/gulp-dataurl
- Owner: Marinerer
- License: mit
- Created: 2023-12-19T12:09:53.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-27T06:55:42.000Z (over 1 year ago)
- Last Synced: 2025-03-28T20:37:18.279Z (2 months ago)
- Topics: base64, data-uri, data-url, gulp-base64, gulp-plugin
- Language: JavaScript
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# gulp-dataurl
[](https://www.npmjs.com/package/gulp-dataurl)
[](https://codecov.io/gh/Meqn/gulp-dataurl)
[](https://github.com/Meqn/pipflow/releases)> A gulp plugin that converts matched file paths into base64-encoded data URI strings.
一个 gulp 插件,用于将匹配到的文件路径转换为 `base64` 编码的 data URI 字符串。
## features
- ☁️ Support for remote files
- 🪝 Customizable file type extensions
- 🚦 Inclusion/exclusion rulesets for selective file encoding
- 🚧 File size limits to prevent overly large Data URLs
- 🚀 Cache duplicate processed files## Usage
Install with npm
```bash
npm install -D gulp-dataurl
```gulp task:
```js
const gulp = require('gulp');
const dataurl = require('gulp-dataurl');gulp.task('html', function() {
return gulp.src('src/**/*.html')
.pipe(dataurl({
remote: true,
extensions: ['.png', '.gif', '.svg'],
include: /\?inline$/i,
exclude: 'node_modules',
limit: 2048 //2kb
}))
.pipe(gulp.dest('dist'));
});
```## Options
#### remote
- Type: `boolean`
- Default: `false`Whether remote files are supported.
#### extensions
- Type: `string | string[]`Supported extensions.
#### include
- Type: `string | string[] | RegExp | RegExp[]`Matching rule patterns.
#### exclude
- Type: `string | string[] | RegExp | RegExp[]`Exclusion rule patterns.
#### limit
- Type: `number`
- Default: `4096`File Size Limit.