diff --git a/lib/stringify/compiler.js b/lib/stringify/compiler.js index 6d01a14d..6939f0bb 100644 --- a/lib/stringify/compiler.js +++ b/lib/stringify/compiler.js @@ -41,10 +41,14 @@ Compiler.prototype.mapVisit = function(nodes, delim){ var buf = ''; delim = delim || ''; + if (Array.isArray(nodes)) { for (var i = 0, length = nodes.length; i < length; i++) { buf += this.visit(nodes[i]); if (delim && i < length - 1) buf += this.emit(delim); } - + } else { + buf += this.visit(nodes); + buf += this.emit(delim); + } return buf; }; diff --git a/lib/stringify/identity.js b/lib/stringify/identity.js index b390c91e..8b7d4f06 100644 --- a/lib/stringify/identity.js +++ b/lib/stringify/identity.js @@ -41,7 +41,8 @@ Compiler.prototype.compile = function(node){ */ Compiler.prototype.stylesheet = function(node){ - return this.mapVisit(node.stylesheet.rules, '\n\n'); + var passedParameter = node.stylesheet ? node.stylesheet.rules : node; + return this.mapVisit(passedParameter, '\n\n'); }; /**