From c70b6c4525d9101b302f6741f6c261bee3600250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Santos?= Date: Tue, 15 Sep 2015 17:12:26 +0100 Subject: [PATCH] pass strip:false to the template engine --- dist/index.js | 6 +++--- dist/lib/svg_image.js | 8 +++++--- lib/svg_image.coffee | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dist/index.js b/dist/index.js index b414fbf..b20fa20 100644 --- a/dist/index.js +++ b/dist/index.js @@ -23,7 +23,7 @@ return function(style) { SVGCache.init(options); return style.eachDecl(/^background|^filter|^content|image$/, function(decl) { - var ___, error, matches, name, params, replace, svg; + var ___, error, error1, matches, name, params, replace, svg; if (!decl.value) { return; } @@ -34,8 +34,8 @@ } try { svg = SVGCache.get(name); - } catch (_error) { - error = _error; + } catch (error1) { + error = error1; if (silent) { console.info("postcss-svg: " + error); } else { diff --git a/dist/lib/svg_image.js b/dist/lib/svg_image.js index f183e91..1615a62 100644 --- a/dist/lib/svg_image.js +++ b/dist/lib/svg_image.js @@ -103,7 +103,9 @@ })(this)); this._checkSVG(doc); doc = new xmldom.XMLSerializer().serializeToString(doc); - return this.template = doT.template(doc); + return this.template = doT.template(doc, _.extend(doT.templateSettings, { + strip: false + })); }; SVGImage.prototype._checkSVG = function(doc) { @@ -205,7 +207,7 @@ }; SVGImage.prototype._addColor = function(type, attributes, node) { - var base, color, key, selectors, typeSelector; + var base, color, error, key, selectors, typeSelector; try { color = attributes[type].value === 'none' ? Color('rgba(255, 255, 255, 0)') : Color(attributes[type].value); typeSelector = "[" + type + "]"; @@ -233,7 +235,7 @@ return "it[\'" + selector + "\']"; }); return node.attributes[attributes[type].index].value = "{{= " + (selectors.join(' || ')) + " || \'" + attributes[type].value + "\'}}"; - } catch (_error) { + } catch (error) { } }; diff --git a/lib/svg_image.coffee b/lib/svg_image.coffee index 6ec76bb..c241b62 100644 --- a/lib/svg_image.coffee +++ b/lib/svg_image.coffee @@ -61,7 +61,7 @@ class SVGImage @_checkSVG(doc) doc = new xmldom.XMLSerializer().serializeToString(doc) - @template = doT.template(doc) + @template = doT.template(doc, _.extend(doT.templateSettings, { strip: false })) _checkSVG: (doc) -> if !(Object.keys(@colors).length > 0)