diff --git a/tasks/svgstore.js b/tasks/svgstore.js
index a04e244..23cdf37 100644
--- a/tasks/svgstore.js
+++ b/tasks/svgstore.js
@@ -20,16 +20,6 @@ module.exports = function (grunt) {
return crypto.createHash('md5').update(str).digest('hex');
};
- var symbolAttributes = function(attrs){
- if (typeof attrs === 'undefined') {return '';}
-
- var result = '';
- Object.keys(attrs).forEach(function (key) {
- result += ' ' + key + '="' + attrs[key] + '"';
- });
- return result;
- };
-
var convertNameToId = function( name ){
var dotPos = name.indexOf('.');
if ( dotPos > -1){
@@ -56,8 +46,6 @@ module.exports = function (grunt) {
symbol: {}
});
- var symbolAttrs = symbolAttributes(options.symbol);
-
this.files.forEach(function (file) {
var $resultDocument = cheerio.load('', { lowerCaseAttributeNames : false }),
$resultSvg = $resultDocument('svg'),
@@ -124,9 +112,12 @@ module.exports = function (grunt) {
var $title = $('title');
var $desc = $('desc');
var $def = $('defs').first();
+ var defContent = $def.length && $def.html();
// Merge in the defs from this svg in the result defs block
- $resultDefs.append($def.html());
+ if (defContent) {
+ $resultDefs.append(defContent);
+ }
var title = $title.first().html();
var desc = $desc.first().html();
@@ -141,26 +132,37 @@ module.exports = function (grunt) {
// If there is no title use the filename
title = title || id;
- var resultStr = '