Skip to content

Commit

Permalink
fixes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
aslansky committed Mar 11, 2014
1 parent 557588d commit 2a763b3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions lib/css-sprite.js
Expand Up @@ -20,7 +20,7 @@ module.exports = function (opt) {
var ctxHeight = 0;
var ctxWidth = 0;

function queue (file, img, cb) {
function queue (file, img) {
sprites.push({
'img': img,
'name': replaceExtension(file.relative, '').replace(/\/|\\|\ /g, '-'),
Expand All @@ -43,8 +43,6 @@ module.exports = function (opt) {
ctxHeight = img.height + 2 * opt.margin;
}
}

cb();
}

function queueImages (file, enc, cb) {
Expand All @@ -57,15 +55,16 @@ module.exports = function (opt) {
cb(new Error('Streaming not supported'));
return; // ignore
}

var img = new Image();
img.src = file.contents;
if (img.complete) {
queue(file, img, cb);
cb();
}
else {
img.onload = function () {
queue(file, img, cb);
cb();
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "css-sprite",
"version": "0.7.0-beta1",
"version": "0.7.0-beta2",
"description": "css sprite generator",
"license": "MIT",
"repository": {
Expand Down
6 changes: 3 additions & 3 deletions tasks/css_sprite.js
Expand Up @@ -23,13 +23,13 @@ module.exports = function(grunt) {
processor: 'css',
orientation: 'vertical',
retina: false,
margin: 5
margin: 5,
prefix: 'icon'
});

var done = this.async();

this.files.forEach(function(f) {
options.src = f.src;
options.src = f.orig.src;
options.name = path.basename(f.dest);
options.out = path.dirname(f.dest);
sprite.create(options, function () {
Expand Down

0 comments on commit 2a763b3

Please sign in to comment.