'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Stringifier = require('postcss/lib/stringifier'); var ScssStringifier = function (_Stringifier) { _inherits(ScssStringifier, _Stringifier); function ScssStringifier() { _classCallCheck(this, ScssStringifier); return _possibleConstructorReturn(this, _Stringifier.apply(this, arguments)); } ScssStringifier.prototype.comment = function comment(node) { var left = this.raw(node, 'left', 'commentLeft'); var right = this.raw(node, 'right', 'commentRight'); if (node.raws.inline) { var text = node.raws.text || node.text; this.builder('//' + left + text + right, node); } else { this.builder('/*' + left + node.text + right + '*/', node); } }; ScssStringifier.prototype.decl = function decl(node, semicolon) { if (!node.isNested) { _Stringifier.prototype.decl.call(this, node, semicolon); } else { var between = this.raw(node, 'between', 'colon'); var string = node.prop + between + this.rawValue(node, 'value'); if (node.important) { string += node.raws.important || ' !important'; } this.builder(string + '{', node, 'start'); var after = void 0; if (node.nodes && node.nodes.length) { this.body(node); after = this.raw(node, 'after'); } else { after = this.raw(node, 'after', 'emptyBody'); } if (after) this.builder(after); this.builder('}', node, 'end'); } }; ScssStringifier.prototype.rawValue = function rawValue(node, prop) { var value = node[prop]; var raw = node.raws[prop]; if (raw && raw.value === value) { return raw.scss ? raw.scss : raw.raw; } else { return value; } }; return ScssStringifier; }(Stringifier); module.exports = ScssStringifier; //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNjc3Mtc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