# @avzuykov/gulp-css-base64

> Gulp's task for transform all resources found in a CSS into base64-encoded data URI strings

Latest version **2.0.3** (published 2022-02-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @avzuykov/gulp-css-base64
pnpm add @avzuykov/gulp-css-base64
yarn add @avzuykov/gulp-css-base64
bun add @avzuykov/gulp-css-base64
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2022-02-17 |
| First published | 2022-01-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 9.3 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alexander Zuykov |
| Maintainers | avzuykov |
| Keywords | gulpplugin, css, base64 |

## Links

- npm: https://www.npmjs.com/package/@avzuykov/gulp-css-base64
- Repository: https://github.com/avzuykov/gulp-css-base64
- Homepage: https://github.com/AVZuykov/gulp-css-base64
- Issues: http://github.com/avzuykov/gulp-css-base64/issues
- npm.io page: https://npm.io/package/@avzuykov/gulp-css-base64

## Dependencies (9)

- [mime](https://npm.io/package/mime.md) ^1.3.4
- [async](https://npm.io/package/async.md) ^1.5.0
- [chalk](https://npm.io/package/chalk.md) ^1.1.1
- [vinyl](https://npm.io/package/vinyl.md) ^2.2.0
- [buffers](https://npm.io/package/buffers.md) ^0.1.1
- [request](https://npm.io/package/request.md) ^2.67.0
- [through2](https://npm.io/package/through2.md) ^2.0.0
- [fancy-log](https://npm.io/package/fancy-log.md) ^1.3.3
- [plugin-error](https://npm.io/package/plugin-error.md) ^1.0.1

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 2.0.3 (latest) — 2022-02-17
- 2.0.2 — 2022-01-24
- 2.0.1 — 2022-01-20

## README

# @avzuykov/gulp-css-base64

## Source

[gulp-css-base64](https://github.com/zckrs/gulp-css-base64)

## Install

Install this plugin with the command:

```js
npm install --save-dev @avzuykov/gulp-css-base64
```

## Usage

```js
var cssBase64 = require('@avzuykov/gulp-css-base64');

//Without options
gulp.task('default', function () {
    return gulp.src('src/css/input.css')
        .pipe(cssBase64())
        .pipe(gulp.dest('dist'));
});

//With options
gulp.task('default', function () {
    return gulp.src('src/css/input.css')
        .pipe(cssBase64({
            baseDir: "../../images",
            maxWeightResource: 100,
            extensionsAllowed: ['.gif', '.jpg']
        }))
        .pipe(gulp.dest('dist'));
});
```

## Options

#### options.baseDir
Type: `String`

Default value: ``

Note: If you have absolute image paths in your stylesheet, the path specified in this option will be used as the base directory. By default plugin used the current directory of gulpfile.js to find local resources.

#### options.maxWeightResource
Type: `Number`

Default value: `infinity`

#### options.extensionsAllowed
Type: `Array`

Default value: `[]`

## Ignore a specific resource

You can ignore a resource with a comment `/*rootFile*/` in CSS file after url definition.
```css
.ignored{
  background: url(image.png); /*rootFile*/
}

.ignored{
  background: url(image.png);
  /*rootFile*/
}

.encoded{
  background: url(image.jpg);
}
```

## License
Copyright (c) 2022 [AVZuykov](https://github.com/AVZuykov) under the MIT License.

---
_Source: https://npm.io/package/@avzuykov/gulp-css-base64 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
