Created
September 25, 2014 13:23
-
-
Save elrrrrrrr/26d392093f20acd83c69 to your computer and use it in GitHub Desktop.
css sprites
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var gulpif = require('gulp-if'); | |
var sprite = require('css-sprite').stream; | |
var base = require('gulp-base64'); | |
// generate sprite.png and _sprite.scss | |
gulp.task('sprites', function () { | |
return gulp.src('img/*.png') | |
.pipe(sprite({ | |
name: 'tx.png', | |
style: '_sprite.styl', | |
cssPath: './img', | |
processor: 'stylus' | |
})) | |
.pipe(gulpif('*.png', gulp.dest('img'), gulp.dest('stylus'))) | |
}); | |
// generate scss with base64 encoded images | |
gulp.task('icon', function () { | |
return gulp.src('img/*.png') | |
.pipe(sprite({ | |
base64: true, | |
style: '_base64.styl', | |
processor: 'stylus' | |
})) | |
.pipe(gulp.dest('stylus')); | |
}); | |
gulp.task('base64', function () { | |
return gulp.src('css/*.css') | |
.pipe(base()) | |
.pipe(gulp.dest('img/')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment