Last active
December 22, 2015 16:22
-
-
Save laozhu/4fface0954c896c7dd57 to your computer and use it in GitHub Desktop.
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'), | |
spritesmith = require('gulp.spritesmith'), | |
merge = require('merge-stream'); | |
// css sprite task | |
gulp.task('css:sprite', () => { | |
var spriteData = gulp.src(sources.sprites).pipe(spritesmith({ | |
imgName: 'sprites.png', | |
imgPath: './src/images/sprites.png', | |
retinaImgName: '[email protected]', | |
retinaImgPath : './src/images/[email protected]', | |
retinaSrcFilter: '**/*@2x.png', | |
cssName: 'sprites.sass', | |
cssFormat: 'sass', | |
algorithm: 'binary-tree' | |
})); | |
var imgStream = spriteData.img.pipe(gulp.dest('./src/images')); | |
var cssStream = spriteData.css.pipe(gulp.dest('./src/styles/sass')); | |
return merge(imgStream, cssStream); | |
}); |
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
images » gulp css:sprite ~/Workspace/f2e-skeleton/src/images | |
[00:19:43] Working directory changed to ~/Workspace/f2e-skeleton | |
[00:19:45] Using gulpfile ~/Workspace/f2e-skeleton/gulpfile.js | |
[00:19:45] Starting 'css:sprite'... | |
events.js:141 | |
throw er; // Unhandled 'error' event | |
^ | |
Error: Invalid file signature | |
at Parser._parseSignature (/Users/ritchie/Workspace/f2e-skeleton/node_modules/pngjs2/lib/parser.js:51:18) | |
at ChunkStream._processRead (/Users/ritchie/Workspace/f2e-skeleton/node_modules/pngjs2/lib/chunkstream.js:174:13) | |
at ChunkStream._process (/Users/ritchie/Workspace/f2e-skeleton/node_modules/pngjs2/lib/chunkstream.js:193:14) | |
at ChunkStream.write (/Users/ritchie/Workspace/f2e-skeleton/node_modules/pngjs2/lib/chunkstream.js:61:8) | |
at ChunkStream.end (/Users/ritchie/Workspace/f2e-skeleton/node_modules/pngjs2/lib/chunkstream.js:74:10) | |
at PNG.end (/Users/ritchie/Workspace/f2e-skeleton/node_modules/pngjs2/lib/png.js:97:16) | |
at PNG.parse (/Users/ritchie/Workspace/f2e-skeleton/node_modules/pngjs2/lib/png.js:87:8) | |
at handlePNG (/Users/ritchie/Workspace/f2e-skeleton/node_modules/get-pixels/node-pixels.js:17:7) | |
at doParse (/Users/ritchie/Workspace/f2e-skeleton/node_modules/get-pixels/node-pixels.js:104:7) | |
at getPixels (/Users/ritchie/Workspace/f2e-skeleton/node_modules/get-pixels/node-pixels.js:134:5) |
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
images » tree ~/Workspace/f2e-skeleton/src/images | |
. | |
└── sprites | |
├── hot.png | |
├── [email protected] | |
├── new.png | |
├── [email protected] | |
├── wechat.png | |
└── [email protected] | |
1 directory, 6 files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment