Sha256: 711fb70512410aabf84fb58a7cccf8dc6bb07a11189088a75c4f08e44e09d065

Contents?: true

Size: 1.17 KB

Versions: 24

Compression:

Stored size: 1.17 KB

Contents

const Stringifier = require('postcss/lib/stringifier');

module.exports = class LessStringifier extends Stringifier {
  atrule(node, semicolon) {
    if (!node.mixin && !node.variable && !node.function) {
      super.atrule(node, semicolon);
      return;
    }

    const identifier = node.function ? '' : node.raws.identifier || '@';
    let name = `${identifier}${node.name}`;
    let params = node.params ? this.rawValue(node, 'params') : '';
    const important = node.raws.important || '';

    if (node.variable) {
      params = node.value;
    }

    if (typeof node.raws.afterName !== 'undefined') {
      name += node.raws.afterName;
    } else if (params) {
      name += ' ';
    }

    if (node.nodes) {
      this.block(node, name + params + important);
    } else {
      const end = (node.raws.between || '') + important + (semicolon ? ';' : '');
      this.builder(name + params + end, node);
    }
  }

  comment(node) {
    if (node.inline) {
      const left = this.raw(node, 'left', 'commentLeft');
      const right = this.raw(node, 'right', 'commentRight');
      this.builder(`//${left}${node.text}${right}`, node);
    } else {
      super.comment(node);
    }
  }
};

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
trusty-cms-6.3.1 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-5.0.7 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-5.0.6 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-5.0.5 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-5.0.4 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-5.0.3 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-5.0.2 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-5.0.1 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-4.3.5 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-5.0.0 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-4.3.4 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-4.3.3 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-4.3.2 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-4.3.1 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-4.3 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-4.2.3 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-4.2.2 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-4.2.1 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-4.2 node_modules/postcss-less/lib/LessStringifier.js
trusty-cms-4.1.9 node_modules/postcss-less/lib/LessStringifier.js