Permalink
Browse files

Merge branch 'dev'

  • Loading branch information...
2 parents 97dbac5 + 5735a07 commit a529e274207c1f7a469a6941c91e69241a3dc885 @deepsweet deepsweet committed May 3, 2013
Showing with 92 additions and 7 deletions.
  1. +9 −0 .npmignore
  2. +1 −0 .svgo.yml
  3. +10 −0 CHANGELOG.md
  4. +1 −3 logo.svg
  5. +1 −1 package.json
  6. +1 −1 plugins/convertPathData.js
  7. +1 −1 plugins/convertTransform.js
  8. +54 −0 plugins/sortAttrs.js
  9. +5 −1 plugins/transformsWithOnePath.js
  10. +9 −0 test/plugins/sortAttrs.01.svg
View
@@ -0,0 +1,9 @@
+docs
+examples
+test
+.editorconfig
+.jshintignore
+.jshintrc
+.travis.yml
+logo.svg
+CHANGELOG.MD
View
@@ -42,3 +42,4 @@ plugins:
- cleanupIDs
- removeUnusedNS
- transformsWithOnePath
+ - sortAttrs
View
@@ -1,3 +1,13 @@
+### [ [>](https://github.com/svg/svgo/tree/v0.3.2) ] 0.3.2 / 03.05.2013
+* new plugin [plugins/sortAttrs](https://github.com/svg/svgo/blob/master/plugins/sortAttrs.js)
+* plugins/transformsWithOnePath: buggy hcrop (fix [#111](https://github.com/svg/svgo/issues/111))
+* Impossible to set output presision to 0 (no fractional part) (fix [#110](https://github.com/svg/svgo/issues/110))
+* Istanbul + coveralls.io
+* update README with NPM version from badge.fury.io
+* update README with dependency status from gemnasium.com
+* npmignore unneeded files
+* reoptimized project logo
+
### [ [>](https://github.com/svg/svgo/tree/v0.3.1) ] 0.3.1 / 15.04.2013
* plugins/transformsWithOnePath: resize SVG and automatically rescale inner Path
* better errors handling
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,6 +1,6 @@
{
"name": "svgo",
- "version": "0.3.1",
+ "version": "0.3.2",
"description": "Nodejs-based tool for optimizing SVG vector graphics files",
"keywords": [ "svgo", "svg", "optimize", "minify" ],
"homepage": "http://svg.github.com/svgo/",
@@ -258,7 +258,7 @@ function filters(path, params) {
if (data) {
- if (params.floatPrecision) {
+ if (params.floatPrecision !== false) {
data = roundData(data, params.floatPrecision);
}
@@ -119,7 +119,7 @@ function convertToShorts(transforms, params) {
// fixed-point numbers
// 12.754997 → 12.755
- if (params.floatPrecision) {
+ if (params.floatPrecision !== false) {
transform.data = transform.data.map(function(num) {
return +num.toFixed(params.floatPrecision);
});
View
@@ -0,0 +1,54 @@
+'use strict';
+
+exports.type = 'perItem';
+
+exports.active = false;
+
+exports.params = {
+ order: [
+ 'xmlns',
+ 'id',
+ 'width', 'height',
+ 'x', 'x1', 'x2',
+ 'y', 'y1', 'y2',
+ 'cx', 'cy', 'r',
+ 'fill', 'fill-opacity', 'fill-rule',
+ 'stroke', 'stroke-opacity', 'stroke-width', 'stroke-miterlimit', 'stroke-dashoffset',
+ 'd', 'points'
+ ]
+};
+
+/**
+ * Sort element attributes for epic readability.
+ *
+ * @param {Object} item current iteration item
+ * @param {Object} params plugin params
+ *
+ * @author Nikolay Frantsev
+ */
+exports.fn = function(item, params) {
+
+ var attrs = [],
+ sorted = {},
+ orderlen = params.order.length + 1;
+
+ if (item.elem) {
+
+ item.eachAttr(function(attr) {
+ attrs.push(attr);
+ });
+
+ attrs.sort(function(a, b) {
+ return ((a = params.order.indexOf(a.name)) > -1 ? a : orderlen) -
+ ((b = params.order.indexOf(b.name)) > -1 ? b : orderlen);
+ });
+
+ attrs.forEach(function (attr) {
+ sorted[attr.name] = attr;
+ });
+
+ item.attrs = sorted;
+
+ }
+
+};
@@ -1,5 +1,9 @@
'use strict';
+/*
+ * Thanks to http://fontello.com project for sponsoring this plugin
+ */
+
exports.type = 'full';
exports.active = false;
@@ -61,7 +65,7 @@ exports.fn = function(data, params) {
path.forEach(function(pathItem) {
// ML
- if (pathItem.instruction === 'ML') {
+ if ('ML'.indexOf(pathItem.instruction) > -1) {
pathItem.data.forEach(function(d, i) {
@@ -0,0 +1,9 @@
+<svg foo="bar" xmlns="http://www.w3.org/2000/svg" height="10" baz="quux" width="10" hello="world">
+ test
+</svg>
+
+@@@
+
+<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" foo="bar" baz="quux" hello="world">
+ test
+</svg>

0 comments on commit a529e27

Please sign in to comment.