Sha256: a654d84d05320ebed0bf9a6e55da1869d1ae0a974e8223d6d1e763bf3ac400f7

Contents?: true

Size: 506 Bytes

Versions: 41

Compression:

Stored size: 506 Bytes

Contents

var nodes = require('../nodes');

/**
 * Returns the @media string for the current block
 *
 * @return {String}
 * @api public
 */

module.exports = function currentMedia(){
  var self = this;
  return new nodes.String(lookForMedia(this.closestBlock.node) || '');

  function lookForMedia(node){
    if ('media' == node.nodeName) {
      node.val = self.visit(node.val);
      return node.toString();
    } else if (node.block.parent.node) {
      return lookForMedia(node.block.parent.node);
    }
  }
};

Version data entries

41 entries across 22 versions & 3 rubygems

Version Path
stylus-source-0.54.5 vendor/lib/functions/current-media.js