How to use the stylus/lib/nodes.null 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 chenckang / react-json-pretty / example / node_modules / stylus-loader / lib / pathcache.js View on Github external
function resolvers(options, webpackResolver) {
  var evaluator = new Evaluator(nodes.null, options);
  var whenWebpackResolver = whenNodefn.lift(webpackResolver);
  return [
    // Stylus's normal resolver for single files.
    function(context, path) {
      // Stylus adds .styl to paths for normal "paths" lookup if it isn't there.
      if (!/.styl$/.test(path)) {
        path += '.styl';
      }

      var found = utils.find(path, options.paths, options.filename)
      if (found) {
        return normalizePaths(found);
      }
    },
    // Stylus's normal resolver for node_modules packages. Cannot locate paths
    // inside a package.
github shama / stylus-loader / lib / pathcache.js View on Github external
function resolvers(options, webpackResolver) {
  var evaluator = new Evaluator(nodes.null, options);
  var whenWebpackResolver = whenNodefn.lift(webpackResolver);

  // Stylus's normal resolver for single files.
  var stylusFile = function(context, path) {
    // Stylus adds .styl to paths for normal "paths" lookup if it isn't there.
    if (!/.styl$/.test(path)) {
      path += '.styl';
    }

    var paths = options.paths.concat(context);
    var found = utils.find(path, paths, options.filename)
    if (found) {
      return normalizePaths(found);
    }
  };
github mockingbot / ibot / scripts / stylus-enhanced-evaluator.js View on Github external
function importFile(node, file, literal, index) {
  var importStack = this.importStack,
    Parser = require("stylus/lib/parser"),
    stat

  // Handling the `require`
  if (node.once) {
    if (this.requireHistory[file]) return nodes.null
    this.requireHistory[file] = true

    if (literal && !this.includeCSS) {
      return node
    }
  }

  // Expose imports
  node.path = file
  node.dirname = path.dirname(file)
  // Store the modified time
  stat = fs.statSync(file)
  node.mtime = stat.mtime
  this.paths.push(node.dirname)

  // Avoid overflows from importing the same file over again
github shama / stylus-loader / lib / evaluator.js View on Github external
if (literal && !this.includeCSS) {
      return node;
    }
  }

  // Expose imports
  node.path = file;
  node.dirname = dirname(file);
  // Store the modified time
  stat = fs.statSync(file);
  node.mtime = stat.mtime;
  this.paths.push(node.dirname);

  // Avoid overflows from importing the same file over again
  if (file === importStack[importStack.length - 1]) return nodes.null;

  if (this.options._imports) this.options._imports.push(node.clone());

  // Parse the file
  importStack.push(file);
  nodes.filename = file;

  var str;
  if (this.cache.sources && this.cache.sources[file]) {
    str = this.cache.sources[file];
  } else {
    str = fs.readFileSync(file, 'utf8');
  }

  if (literal && !this.resolveURL) return new nodes.Literal(str.replace(/\r\n?/g, '\n'));
github cozy / cozy-ui / stylus / scripts / deprecate.js View on Github external
style.define('deprecate', function (msg) {
      const parentSel = last(this.selectorStack)[0]
      console.log(chalk.yellow('\nDeprecation: ' + parentSel.filename + ':' + parentSel.lineno + '\n' + msg.val))
      return nodes.null
    })
  }