# gulp-spriters

> gulp-sprites ![npm version](https://img.shields.io/npm/v/gulp-spriters.svg) ![build](https://travis-ci.org/progrape/gulp-spriters.svg) ===

Latest version **1.0.1** (published 2015-12-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-spriters
pnpm add gulp-spriters
yarn add gulp-spriters
bun add gulp-spriters
```

## 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 | 1.0.1 |
| Published | 2015-12-02 |
| First published | 2015-01-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | jfengjiang |

## Links

- npm: https://www.npmjs.com/package/gulp-spriters
- Repository: https://github.com/progrape/gulp-spriters
- Homepage: https://github.com/progrape/gulp-spriters#readme
- Issues: https://github.com/progrape/gulp-spriters/issues
- npm.io page: https://npm.io/package/gulp-spriters

## Dependencies (6)

- [jimp](https://npm.io/package/jimp.md) ^0.2.19
- [lodash](https://npm.io/package/lodash.md) ^3.10.1
- [bin-pack](https://npm.io/package/bin-pack.md) ^1.0.1
- [bluebird](https://npm.io/package/bluebird.md) ^3.0.5
- [through2](https://npm.io/package/through2.md) ^0.6.3
- [gulp-util](https://npm.io/package/gulp-util.md) ^3.0.1

## Recent versions

- 1.0.1 (latest) — 2015-12-02
- 1.0.0 — 2015-12-01
- 0.0.4 — 2015-01-01
- 0.0.3 — 2015-01-01
- 0.0.2 — 2015-01-01

## README

gulp-sprites ![npm version](https://img.shields.io/npm/v/gulp-spriters.svg) ![build](https://travis-ci.org/progrape/gulp-spriters.svg)
===


##简介

自动拼接css文件中指定需要合并的图片，支持@2x图片。图片处理基于[jimp](https://github.com/oliver-moran/jimp)，无需安装其他复杂的依赖。

##安装

```
npm install --save-dev gulp-spriters
```

##使用

css文件：

```css
/* icon.css */
.icon_button2{
    display: inline-block;
    vertical-align: middle;
    width: 56px;
    height: 56px;
    /* here will be replace sprite image path, and auto set the background-position */
    background: url("./images/button.png?__sprite");
}

.icon_msg2{
    display: inline-block;
    vertical-align: middle;
    width: 56px;
    height: 56px;
    /* here will be replace sprite image path, and auto set the background-position */
    background: url("./images/msg.png?__sprite");
}

.icon_shake2{
    display: inline-block;
    vertical-align: middle;
    width: 45px;
    height: 45px;
    /* here will be replace sprite image path, and auto set the background-position */
    background: url("./images/shake@2x.png?__sprite");
}

.icon_nearby2{
    display: inline-block;
    vertical-align: middle;
    width: 45px;
    height: 45px;
    /* here will be replace sprite image path, and auto set the background-position */
    background: url("./images/nearby@2x.png?__sprite");
}
```

gulpfile.js文件：

```javascript

var spriters = require('gulp-spriters');

gulp.src('src/**/*.css')
    .pipe(spriters())
    .pipe(gulp.dest('dist/style'));

```

拼接后的图片文件名为`icon_z.png`或`icon_z@2x.png`，自动修正`background-position`和`background-size`。


## License

gulp-spriters is licensed under the MIT license.

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