Skip to content

Commit

Permalink
new plugins/cropAndCenterAlongPath
Browse files Browse the repository at this point in the history
  • Loading branch information
deepsweet committed Apr 5, 2013
1 parent 55a5e23 commit 7f5512b
Show file tree
Hide file tree
Showing 6 changed files with 747 additions and 251 deletions.
22 changes: 14 additions & 8 deletions .svgo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ plugins:
active: true
type: perItem

- name: cleanupEnableBackground
active: true
type: perItem

- name: removeHiddenElems
active: true
type: perItem
Expand Down Expand Up @@ -115,6 +111,10 @@ plugins:
active: true
type: perItemReverse

- name: collapseGroups
active: true
type: perItemReverse

- name: moveGroupAttrsToElems
active: true
type: perItemReverse
Expand Down Expand Up @@ -163,14 +163,20 @@ plugins:
remove: true
minify: true

- name: collapseGroups
active: true
type: perItemReverse

- name: removeUnusedNS
active: true
type: full

- name: cropAndCenterAlongPath
active: false
type: full
params:
hcrop: true
vcenter: true
floatPrecision: 3
leadingZero: true
negativeExtraSpace: true

svg2js:

strict: true
Expand Down
26 changes: 9 additions & 17 deletions lib/svgo/coa.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module.exports = require('coa').Cmd()
})
.end()
.opt()
.name('config').title('Local config file to extend default')
.name('config').title('Local config file')
.short('c').long('config')
.val(function(val) {
return val || this.reject('Option --config must have a value.');
Expand Down Expand Up @@ -172,24 +172,16 @@ module.exports = require('coa').Cmd()
*/
function saveFileAndPrintInfo(result, output, pretty) {

if (!pretty && result.info.outBytes >= result.info.inBytes) {
// output file
output = FS.createWriteStream(output, { encoding: 'utf8' });
output.write(result.data);
output.end();

UTIL.puts('There is nothing to optimize!\n'.yellow);
// print time info
printTimeInfo(result.info.time);

} else {

// output file
output = FS.createWriteStream(output, { encoding: 'utf8' });
output.write(result.data);
output.end();

// print time info
printTimeInfo(result.info.time);

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

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

}

Expand Down
5 changes: 1 addition & 4 deletions lib/svgo/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ function _getConfig(params) {
if (!exist) return defaultConfig;

// if it exists then return extended default
return readConfig(localConfigPath)
.then(function(localConfig) {
return extend(true, defaultConfig, localConfig);
});
return readConfig(localConfigPath);

});
}
Expand Down
Loading

0 comments on commit 7f5512b

Please sign in to comment.