From 72a7186fcca09f9bb7165da81930ff807d98d8a9 Mon Sep 17 00:00:00 2001 From: Daniel Mazurkiewicz Date: Sun, 6 Apr 2014 19:05:34 +0200 Subject: [PATCH] Update cleanupIDs.js added "prefix" parameter to solve problem of combining multiple svg into one svg or html file --- plugins/cleanupIDs.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/cleanupIDs.js b/plugins/cleanupIDs.js index 592b0fa15..4641ae139 100644 --- a/plugins/cleanupIDs.js +++ b/plugins/cleanupIDs.js @@ -6,7 +6,8 @@ exports.active = true; exports.params = { remove: true, - minify: true + minify: true, + prefix: '' }; var referencesProps = require('./_collections').referencesProps, @@ -123,7 +124,7 @@ exports.fn = function(data, params) { // replace referenced IDs with the minified ones if (params.minify) { - currentIDstring = getIDstring(currentID = generateID(currentID)); + currentIDstring = getIDstring(currentID = generateID(currentID), params); IDs[k].attr('id').value = currentIDstring; referencesIDs[k].forEach(function(attr) { @@ -190,9 +191,9 @@ function generateID(currentID) { * @param {Array} arr input ID array * @return {String} output ID string */ -function getIDstring(arr) { +function getIDstring(arr, params) { - var str = ''; + var str = params.prefix; arr.forEach(function(i) { str += generateIDchars[i];