Skip to content

Commit 2a763b3

Browse files
committed
fixes #5
1 parent 557588d commit 2a763b3

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

lib/css-sprite.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = function (opt) {
2020
var ctxHeight = 0;
2121
var ctxWidth = 0;
2222

23-
function queue (file, img, cb) {
23+
function queue (file, img) {
2424
sprites.push({
2525
'img': img,
2626
'name': replaceExtension(file.relative, '').replace(/\/|\\|\ /g, '-'),
@@ -43,8 +43,6 @@ module.exports = function (opt) {
4343
ctxHeight = img.height + 2 * opt.margin;
4444
}
4545
}
46-
47-
cb();
4846
}
4947

5048
function queueImages (file, enc, cb) {
@@ -57,15 +55,16 @@ module.exports = function (opt) {
5755
cb(new Error('Streaming not supported'));
5856
return; // ignore
5957
}
60-
6158
var img = new Image();
6259
img.src = file.contents;
6360
if (img.complete) {
6461
queue(file, img, cb);
62+
cb();
6563
}
6664
else {
6765
img.onload = function () {
6866
queue(file, img, cb);
67+
cb();
6968
};
7069
}
7170
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "css-sprite",
3-
"version": "0.7.0-beta1",
3+
"version": "0.7.0-beta2",
44
"description": "css sprite generator",
55
"license": "MIT",
66
"repository": {

tasks/css_sprite.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ module.exports = function(grunt) {
2323
processor: 'css',
2424
orientation: 'vertical',
2525
retina: false,
26-
margin: 5
26+
margin: 5,
27+
prefix: 'icon'
2728
});
2829

2930
var done = this.async();
30-
3131
this.files.forEach(function(f) {
32-
options.src = f.src;
32+
options.src = f.orig.src;
3333
options.name = path.basename(f.dest);
3434
options.out = path.dirname(f.dest);
3535
sprite.create(options, function () {

0 commit comments

Comments
 (0)