# gulp-css-retina

> background-image for retina

Latest version **0.0.2** (published 2016-06-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-css-retina
pnpm add gulp-css-retina
yarn add gulp-css-retina
bun add gulp-css-retina
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2016-06-21 |
| First published | 2016-06-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+7 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Gavin Tang |
| Maintainers | germanyt |
| Keywords | retina, srcset, image, gulpplugin |

## Links

- npm: https://www.npmjs.com/package/gulp-css-retina
- Repository: https://github.com/germanyt/gulp-css-retina
- Issues: https://github.com/germanyt/gulp-css-retina/issues
- npm.io page: https://npm.io/package/gulp-css-retina

## Dependencies (4)

- [images](https://npm.io/package/images.md) ^3.0.0
- [postcss](https://npm.io/package/postcss.md) ^5.0.21
- [through2](https://npm.io/package/through2.md) ^2.0.1
- [object-assign](https://npm.io/package/object-assign.md) ^4.1.0

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2016-06-21

## README

# gulp-css-retina
background-image for retina

## Prerequisites
You must have a 2x image in the folder which the original image in.

## Install

`npm install gulp-css-retina`

## Usage

``` js
var gulp = require('gulp');
var cssRetina = require('gulp-css-retina');

var retinaOpts = {
    // Your options here.
};

gulp.task('css', function() {

  return gulp.src('./css/**/*.css')
    .pipe(cssRetina(retinaOpts))
    .on('error', function(e) {
      console.log(e.message);
    })
    .pipe(gulp.dest('./build'));

});
```

You put css in:
``` css
.index .info .avatar {
  background: url(/images/brand.png) no-repeat 0 0;
}
.index .info .name {
  background-image: url("/images/brand.png");
}
```

And get css out:
``` css
.index .info .avatar {
  background: url(/images/brand.png) no-repeat 0 0;
}
.index .info .name {
  background-image: url("/images/brand.png");
}
@media (min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .index .info .avatar {
    background-size: 170px 78px;
    background-image: url(/images/brand@2x.png);
  }
  .index .info .name {
    background-size: 170px 78px;
    background-image: url(/images/brand@2x.png);
  }
}
```

## Options (Optional)

### options.sourcePath
Type: ```String```

Default: ```process.cwd()```

The file path `path.join(options.sourcePath, backgroundImage's Url value)` must exist, otherwise skip this rule.

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