How to use the stylus/lib/visitor/evaluator.prototype function in stylus

To help you get started, we’ve selected a few stylus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mockingbot / ibot / scripts / stylus-enhanced-evaluator.js View on Github external
throw err
  }

  // Evaluate imported "root"
  block.parent = this.root
  block.scope = false
  var ret = this.visit(block)
  importStack.pop()
  if (importStack.length || index) this.paths.pop()

  return ret
}
function EnhancedEvaluator(root, optios) {
  Evaluator.apply(this, arguments)
}
EnhancedEvaluator.prototype = Object.create(Evaluator.prototype)
EnhancedEvaluator.prototype.constructor = EnhancedEvaluator
EnhancedEvaluator.prototype.visitImport = function(imported) {
  this.return++

  var path = this.visit(imported.path).first,
    nodeName = imported.once ? "require" : "import",
    found,
    literal,
    index

  this.return--

  // url() passed
  if ("url" == path.name) {
    if (imported.once) throw new Error("You cannot @require a url")
github shama / stylus-loader / lib / evaluator.js View on Github external
block.parent = this.root;
  block.scope = false;
  var ret = this.visit(block);
  importStack.pop();
  if (importStack.length || index) this.paths.pop();

  return ret;
}

function CachedPathEvaluator(root, options) {
  Evaluator.apply(this, arguments);

  this.cache = options.cache;
}

CachedPathEvaluator.prototype = Object.create(Evaluator.prototype);
CachedPathEvaluator.prototype.constructor = CachedPathEvaluator;

CachedPathEvaluator.prototype.visitImport = function(imported) {
  this.return++;

  var path = this.visit(imported.path).first
    , nodeName = imported.once ? 'require' : 'import'
    , found
    , literal
    , index;

  this.return--;
  // debug('import %s', path);

  // url() passed
  if ('url' == path.name) {