Skip to content

Commit

Permalink
lib/coa: optimize folder file by file (temp fix #114)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepsweet committed Jun 6, 2013
1 parent 8d2e487 commit 84df823
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/svgo/coa.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,12 @@ function optimizeFolder(path, config) {
throw err;
}

files.forEach(function(filename) {
var i = 0;

function optimizeFile(file) {

// absoluted file path
var filepath = PATH.resolve(path, filename);
var filepath = PATH.resolve(path, file);

// check if file name matches *.svg
if (regSVGFile.test(filepath)) {
Expand Down Expand Up @@ -395,14 +397,18 @@ function optimizeFolder(path, config) {

FS.writeFile(filepath, result.data, 'utf8', function() {

UTIL.puts(filename + ':');
UTIL.puts(file + ':');

// print time info
printTimeInfo(time);

// print optimization profit info
printProfitInfo(inBytes, outBytes);

if (++i < files.length) {
optimizeFile(files[i]);
}

});

});
Expand All @@ -411,7 +417,9 @@ function optimizeFolder(path, config) {

}

});
}

optimizeFile(files[i]);

});

Expand Down

0 comments on commit 84df823

Please sign in to comment.