|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- "use strict";
-
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
-
- var Stringifier = require('postcss/lib/stringifier');
-
- var ScssStringifier =
- /*#__PURE__*/
- function (_Stringifier) {
- _inheritsLoose(ScssStringifier, _Stringifier);
-
- function ScssStringifier() {
- return _Stringifier.apply(this, arguments) || this;
- }
-
- var _proto = ScssStringifier.prototype;
-
- _proto.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);
- }
- };
-
- _proto.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;
-
- 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');
- }
- };
-
- _proto.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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNjc3Mtc3RyaW5naWZpZXIuZXM2Il0sIm5hbWVzIjpbIlN0cmluZ2lmaWVyIiwicmVxdWlyZSIsIlNjc3NTdHJpbmdpZmllciIsImNvbW1lbnQiLCJ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