Skip to content

Commit

Permalink
Updated dependencies (still incomplete)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkphl committed Feb 1, 2016
1 parent 57ad5bd commit 5bc315a
Show file tree
Hide file tree
Showing 12 changed files with 1,148 additions and 41 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.2.20 Maintenance release (unreleased)
* Updated dependencies (still incomplete)

## 1.2.19 Maintenance release (2016-01-11)
* Updated dependencies
* Temporarily fixed xmldom dependency problem ([#135](https://github.com/jkphl/svg-sprite/issues/135))
Expand Down
2 changes: 1 addition & 1 deletion bin/svg-sprite.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ config.shape.transform = [];
var transformConfigFile = argv['transform-' + transform],
transformConfigJSON = fs.readFileSync(path.resolve(transformConfigFile), {encoding: 'utf8'}),
transformConfig = transformConfigJSON.trim() ? JSON.parse(transformConfigJSON) : {};
this.push(_.object([transform], [transformConfig]));
this.push(_.zipObject([transform], [transformConfig]));
} catch(e) {}
} else {
this.push(transform);
Expand Down
31 changes: 16 additions & 15 deletions lib/svg-sprite.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@
* @license MIT https://raw.github.com/jkphl/svg-sprite/master/LICENSE.txt
*/

var CONFIG = require('./svg-sprite/config'),
QUEUE = require('./svg-sprite/queue'),
SVGO = require('./svg-sprite/transform/svgo'),
LAYOUTER = require('./svg-sprite/layouter'),
_ = require('lodash'),
path = require('path'),
File = require('vinyl'),
events = require('events'),
async = require('async'),
os = require('os'),
pretty = require('prettysize'),
util = require('util');
var CONFIG = require('./svg-sprite/config');
var QUEUE = require('./svg-sprite/queue');
var SVGO = require('./svg-sprite/transform/svgo');
var LAYOUTER = require('./svg-sprite/layouter');
var _ = require('lodash');
var pluck = require('lodash.pluck');
var path = require('path');
var File = require('vinyl');
var events = require('events');
var async = require('async');
var os = require('os');
var pretty = require('prettysize');
var util = require('util');

/**
* SVGSpriter class
Expand Down Expand Up @@ -80,7 +81,7 @@ SVGSpriter.prototype.add = function(file, name, svg) {
// If no vinyl file object has been given
if (!this._isVinylFile(file)) {
file = _.trim(file);
name = _.trimLeft(_.trim(name), path.sep + '.') || path.basename(file);
name = _.trimStart(_.trim(name), path.sep + '.') || path.basename(file);
svg = _.trim(svg);

// Argument validation
Expand Down Expand Up @@ -291,7 +292,7 @@ SVGSpriter.prototype._layout = function(config, cb) {
}

async.parallelLimit(tasks, os.cpus().length * 2, function(error, data){
cb(error, files, _.object(_.pluck(data, 'key'), data));
cb(error, files, _.zipObject(pluck(data, 'key'), data));
});
};

Expand Down Expand Up @@ -352,7 +353,7 @@ SVGSpriter.prototype._logStats = function(files) {
sizes[file] = pretty(files[mode][resource].contents.length);
}
}
this.info('Created ' + _.pairs(exts).map(function(ext){
this.info('Created ' + _.toPairs(exts).map(function(ext){
return ext[1] + ' x ' + ext[0].substr(1);
}).join(', '));

Expand Down
11 changes: 6 additions & 5 deletions lib/svg-sprite/mode/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
* @license MIT https://raw.github.com/jkphl/svg-sprite/master/LICENSE
*/

var _ = require('lodash'),
util = require('util'),
SVGSpriteBase = require('./base'),
SVGSprite = require('../sprite');
var _ = require('lodash');
var pluck = require('lodash.pluck');
var util = require('util');
var SVGSpriteBase = require('./base');
var SVGSprite = require('../sprite');

/**
* CSS sprite
Expand Down Expand Up @@ -431,7 +432,7 @@ SVGSpriteCss.prototype._buildSVG = function(xmlDeclaration, doctypeDeclaration)
}
),
svg = new SVGSprite(this.declaration(this.config.svg.xmlDeclaration, xmlDeclaration), this.declaration(this.config.svg.doctypeDeclaration, doctypeDeclaration), rootAttributes, true, this.config.svg.transform);
svg.add(_.pluck(this.data.shapes, 'svg'));
svg.add(pluck(this.data.shapes, 'svg'));

return svg.toFile(this._spriter.config.dest, this._addCacheBusting(svg));
};
Expand Down
9 changes: 5 additions & 4 deletions lib/svg-sprite/mode/defs.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
* @license MIT https://raw.github.com/jkphl/svg-sprite/master/LICENSE
*/

var _ = require('lodash'),
SVGSpriteStandalone = require('./standalone'),
SVGSprite = require('../sprite');
var _ = require('lodash');
var pluck = require('lodash.pluck');
var SVGSpriteStandalone = require('./standalone');
var SVGSprite = require('../sprite');

/**
* <defs> sprite
Expand Down Expand Up @@ -85,7 +86,7 @@ SVGSpriteDefs.prototype._buildSVG = function(xmlDeclaration, doctypeDeclaration)
}
) : rootAttributes, !inline, this.config.svg.transform);
svg.add('<defs>');
svg.add(_.pluck(this.data.shapes, 'svg'));
svg.add(pluck(this.data.shapes, 'svg'));
svg.add('</defs>');

return svg.toFile(this._spriter.config.dest, this._addCacheBusting(svg));
Expand Down
9 changes: 5 additions & 4 deletions lib/svg-sprite/mode/stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
* @license MIT https://raw.github.com/jkphl/svg-sprite/master/LICENSE
*/

var _ = require('lodash'),
SVGSpriteStandalone = require('./standalone'),
SVGSprite = require('../sprite');
var _ = require('lodash');
var pluck = require('lodash.pluck');
var SVGSpriteStandalone = require('./standalone');
var SVGSprite = require('../sprite');

/**
* SVG stack
Expand Down Expand Up @@ -94,7 +95,7 @@ SVGSpriteStack.prototype._buildSVG = function(xmlDeclaration, doctypeDeclaration
),
svg = new SVGSprite(this.declaration(this.config.svg.xmlDeclaration, xmlDeclaration), this.declaration(this.config.svg.doctypeDeclaration, doctypeDeclaration), rootAttributes, true, this.config.svg.transform);
svg.add('<style>:root>svg{display:none}:root>svg:target{display:block}</style>');
svg.add(_.pluck(this.data.shapes, 'svg'));
svg.add(pluck(this.data.shapes, 'svg'));

return svg.toFile(this._spriter.config.dest, this._addCacheBusting(svg));
};
Expand Down
11 changes: 6 additions & 5 deletions lib/svg-sprite/mode/symbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
* @license MIT https://raw.github.com/jkphl/svg-sprite/master/LICENSE
*/

var _ = require('lodash'),
SVGSpriteStandalone = require('./standalone'),
SVGSprite = require('../sprite'),
symbolAttributes = ['id', 'xml:base', 'xml:lang', 'xml:space', 'onfocusin', 'onfocusout', 'onactivate', 'onclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmousemove', 'onmouseout', 'onload', 'alignment-baseline', 'baseline-shift', 'clip', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cursor', 'direction', 'display', 'dominant-baseline', 'enable-background', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'image-rendering', 'kerning', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'opacity', 'overflow', 'pointer-events', 'shape-rendering', 'stop-color', 'stop-opacity', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'unicode-bidi', 'visibility', 'word-spacing', 'writing-mode', 'class', 'style', 'externalResourcesRequired', 'preserveAspectRatio', 'viewBox', 'aria-labelledby'];
var _ = require('lodash');
var pluck = require('lodash.pluck');
var SVGSpriteStandalone = require('./standalone');
var SVGSprite = require('../sprite');
var symbolAttributes = ['id', 'xml:base', 'xml:lang', 'xml:space', 'onfocusin', 'onfocusout', 'onactivate', 'onclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmousemove', 'onmouseout', 'onload', 'alignment-baseline', 'baseline-shift', 'clip', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cursor', 'direction', 'display', 'dominant-baseline', 'enable-background', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'image-rendering', 'kerning', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'opacity', 'overflow', 'pointer-events', 'shape-rendering', 'stop-color', 'stop-opacity', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'unicode-bidi', 'visibility', 'word-spacing', 'writing-mode', 'class', 'style', 'externalResourcesRequired', 'preserveAspectRatio', 'viewBox', 'aria-labelledby'];

/**
* <symbol> sprite
Expand Down Expand Up @@ -86,7 +87,7 @@ SVGSpriteSymbol.prototype._buildSVG = function(xmlDeclaration, doctypeDeclaratio
style : 'position:absolute'
}
) : rootAttributes, !inline, this.config.svg.transform);
svg.add(_.pluck(this.data.shapes, 'svg'));
svg.add(pluck(this.data.shapes, 'svg'));

return svg.toFile(this._spriter.config.dest, this._addCacheBusting(svg));
};
Expand Down
2 changes: 1 addition & 1 deletion lib/svg-sprite/shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function SVGShape(file, spriter) {
// Determine meta & alignment data
var relative = path.basename(this.source.relative, '.svg');
this.meta = (this.id in this.config.meta) ? this.config.meta[this.id] : ((relative in this.config.meta) ? this.config.meta[relative] : {});
this.align = _.pairs(_.extend(this.config.align['*'], (this.id in this.config.align) ? this.config.align[this.id] : ((relative in this.config.align) ? this.config.align[relative] : {})));
this.align = _.toPairs(_.extend(this.config.align['*'], (this.id in this.config.align) ? this.config.align[this.id] : ((relative in this.config.align) ? this.config.align[relative] : {})));

// Initially set the SVG of this shape
this._initSVG();
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "svg-sprite",
"version": "1.2.19",
"version": "1.2.20",
"author": "Joschi Kuphal <[email protected]> (https://jkphl.is)",
"description": "SVG sprites & stacks galore — A low-level Node.js module that takes a bunch of SVG files, optimizes them and bakes them into SVG sprites of several types along with suitable stylesheet resources (e.g. CSS, Sass, LESS, Stylus, etc.)",
"homepage": "https://github.com/jkphl/svg-sprite",
Expand Down Expand Up @@ -37,9 +37,10 @@
"dependencies": {
"mkdirp": "^0.5.1",
"async": "^1.5.2",
"lodash": "^3.10.1",
"lodash": "^4.1.0",
"lodash.pluck": "^3.1.2",
"glob": "^6.0.4",
"xmldom": "0.1.19",
"xmldom": "0.1.22",
"xpath": "^0.0.9",
"vinyl": "^1.1.0",
"svgo": "0.6.1",
Expand Down
Loading

0 comments on commit 5bc315a

Please sign in to comment.