Table
此版本
只是修改了 var css_img_sprite = require('css-img-sprite-rain');
frok
forked from king-king/gulp-css-img-sprite
Install
npm install css-img-sprite
Gulp Version
- Gulp : gulp-css-img-sprite
How To Write CSS
shop: bag:
- add '?__sprite' or '?__spriter' at the end of url to do sprite:
after sprite:
-
you can scale the image by set background-size.we can put the same scale images into one output image.
-
you can not use repeat,repeat-x or repeat-y with scale!=1,for example: you scale the image 2 times and you also use repeat-x,as a result, although you add '?__spriter',you will not get sprite image.
you can write css like this:
/*or*/
- you can use auto to set background-size
/* or *//* or */
How To Write JS
- Arguments Guide
/** * arguments: * spriteObj: * spriteObj.cssSrc: * [spriteObj.cssDesDir]: * you need do it yourself.we need it because we need to change * css background-image:url() * [spriteObj.imgDesDir]: * [spriteObj.layout]: * [spriteObj.hash]: **/
for example
var sprite = ;var gulp = ; var outDir = "build"; gulp ;
Important:you must make sure cssDesDir is as same as gulp.dest
Example
you can see the usage in test folder