Skip to content

Commit

Permalink
feat(core): optional dests
Browse files Browse the repository at this point in the history
  • Loading branch information
balthazar committed Sep 11, 2015
1 parent 5bf3f55 commit 9cd4308
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions bin/spritesmith
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,20 @@ function run (data) {
}
}

function persist (result, data) {
function createImage (result, data) {

if (!data.destImage) { return; }

mkdirp.sync(path.dirname(data.destImage))
fs.writeFileSync(data.destImage, result.image, 'binary');

console.log('[spritesmith] "%s" created.', data.destImage);
}

function createCSS (result, data) {

if (!data.destCSS) { return; }

var coordinates = result.coordinates;
var properties = result.properties;
var spritePath = data.imgPath || url.relative(data.destCSS, data.destImage);
Expand Down Expand Up @@ -104,7 +114,13 @@ function persist (result, data) {
mkdirp.sync(path.dirname(data.destCSS));
fs.writeFileSync(data.destCSS, cssStr, 'utf8');

console.log('Files "%s", and "%s" created.', data.destCSS, data.destImage);
console.log('[spritesmith] "%s" created.', data.destCSS);

}

function persist (result, data) {
createImage(result, data);
createCSS(result, data);
}

function noop () {}

0 comments on commit 9cd4308

Please sign in to comment.