Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
deepsweet committed Jun 6, 2013
2 parents cb0ec95 + 8a6b0bf commit bef75f8
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 16 deletions.
3 changes: 1 addition & 2 deletions .jshintrc
Expand Up @@ -20,6 +20,5 @@
"undef": true,
"unused": true,
"loopfunc": true,
"trailing": true,
"es5": true
"trailing": true
}
2 changes: 0 additions & 2 deletions .travis.yml
Expand Up @@ -13,5 +13,3 @@ matrix:
branches:
only:
- master

script: make travis
7 changes: 7 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,10 @@

### [ [>](https://github.com/svg/svgo/tree/v0.3.6) ] 0.3.6 / 06.06.2013
* plugins/removeNonInheritableGroupAttrs: more attrs groups to exclude (fix [#116](https://github.com/svg/svgo/issues/116) & [#118](https://github.com/svg/svgo/issues/118))
* lib/coa: optimize folder file by file (temp fix #114](https://github.com/svg/svgo/issues/114))
* `.jshintrc`: JSHint 2.0
* temporarily disable node-coveralls

### [ [>](https://github.com/svg/svgo/tree/v0.3.5) ] 0.3.5 / 07.05.2013
* plugins/transformsWithOnePath: fix curves bounding box calculation
* plugins/transformsWithOnePath: fix possible c+t or q+s bug
Expand Down
16 changes: 12 additions & 4 deletions lib/svgo/coa.js
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
5 changes: 2 additions & 3 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "svgo",
"version": "0.3.5",
"version": "0.3.6",
"description": "Nodejs-based tool for optimizing SVG vector graphics files",
"keywords": [ "svgo", "svg", "optimize", "minify" ],
"homepage": "http://svg.github.com/svgo/",
Expand Down Expand Up @@ -45,8 +45,7 @@
"mocha": "~1.9.0",
"should": "~1.2.0",
"istanbul": "~0.1.0",
"mocha-istanbul": "",
"coveralls": ""
"mocha-istanbul": ""
},
"engines": {
"node": ">=0.6.0"
Expand Down
11 changes: 7 additions & 4 deletions plugins/removeNonInheritableGroupAttrs.js
Expand Up @@ -5,7 +5,7 @@ exports.type = 'perItem';
exports.active = true;

var inheritableAttrs = require('./_collections').inheritableAttrs,
presentationAttrs = require('./_collections').attrsGroups.presentation,
attrsGroups = require('./_collections').attrsGroups,
excludedAttrs = ['display', 'opacity'];

/**
Expand All @@ -22,9 +22,12 @@ exports.fn = function(item) {

item.eachAttr(function(attr) {
if (
presentationAttrs.indexOf(attr.name) !== -1 &&
excludedAttrs.indexOf(attr.name) === -1 &&
inheritableAttrs.indexOf(attr.name) === -1
~attrsGroups.presentation.indexOf(attr.name) &&
~attrsGroups.graphicalEvent.indexOf(attr.name) &&
~attrsGroups.core.indexOf(attr.name) &&
~attrsGroups.conditionalProcessing.indexOf(attr.name) &&
!~excludedAttrs.indexOf(attr.name) &&
!~inheritableAttrs.indexOf(attr.name)
) {
item.removeAttr(attr.name);
}
Expand Down
2 changes: 1 addition & 1 deletion test/plugins/removeNonInheritableGroupAttrs.01.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bef75f8

Please sign in to comment.