How to use the nib.path function in nib

To help you get started, we’ve selected a few nib 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 DefinitelyTyped / DefinitelyTyped / types / stylus / stylus-tests.ts View on Github external
* .set(setting, value)
 * https://github.com/LearnBoost/stylus/blob/master/docs/js.md#setsetting-value
 */
stylus(str)
    .set('filename', __dirname + '/test.styl')
    .set('paths', [__dirname, __dirname + '/mixins'])
    .render(function (err, css) {
        // logic
    });

/**
 * .include(path)
 * https://github.com/LearnBoost/stylus/blob/master/docs/js.md#includepath
 */
stylus(str)
    .include(require('nib').path)
    .include(process.env.HOME + '/mixins')
    .render(function (err, css) {
        // logic
    });

/**
 * .import(path)
 * https://github.com/LearnBoost/stylus/blob/master/docs/js.md#importpath
 */
stylus(str)
    .set('filename', __dirname + '/test.styl')
    .import('mixins/vendor')
    .render(function (err, css) {
        if (err) throw err;
        console.log(css);
    });
github walmartlabs / lumbar / lib / plugins / stylus-worker.js View on Github external
.set('compress', minimize);

  if (!stylusImages.plugin) {
    compiler.use(stylusImages(options.images));
  }

  compiler
    .use(pathScopes(msg))
    .include(lookupPath);

  if (styleRoot) {
    compiler.include(styleRoot);
  }
  if (useNib) {
    compiler
      .include(nib.path)
      .use(nib);
  }

  // Allow any plugins to do their thing
  _.each(plugins, function(plugin) {
    var data = plugin.data;

    plugin = require(plugin.plugin);
    plugin(compiler, data);
  });

  try {
    compiler.render(function(err, data) {
      var inputs = compiler.options._imports
              .concat(compiler.options.externals)
              .map(function(file) { return file.path || file; })
github tonistiigi / styler / lib / backend / console.js View on Github external
Console.prototype.stylusSetFileImports = function(file, imports) {
      var nibpath;
      if (!imports) {
        return delete this.imports[file];
      }
      nibpath = require("nib").path;
      return this.imports[file] = _.compact(_.map(imports, (function(_this) {
        return function(item) {
          var furl, name, path, url;
          if (item.path === STYLUS_FUNC_FILE) {
            return;
          }
          path = item.path;
          url = _this.pathToUrl(path);
          file = _this.files.find(function(f) {
            return f.srcpath === path;
          });
          if (!file) {
            furl = 0 === path.indexOf(nibpath) ? path.slice(nibpath.length + 1) : Math.random() * 1e6 | 0;
            name = _.last(path.split(/[\\\/]/));
            fs.stat(path, function(err, stat) {
              return _this.files.create({
github csanz / node-expressjs-example / config / config.js View on Github external
function compile(str, path) {
    return stylus(str)
      .set('filename', path)
      .include(nib.path)
  }
github sequelize / sequelize-admin / lib / router.js View on Github external
Router.prototype.serveStylus = function(req, res) {
  var path          = null
    , stylusContent = null

  path              = req.path.replace('/css/compiled', '/stylus').replace('.css', '.styl')
  path              = __dirname + '/..' + path.replace(this.options.endpoint, '')
  stylusContent     = fs.readFileSync(path).toString()

  stylus(stylusContent)
    .include(require('nib').path)
    .render(function(err, css) {
      if (err) {
        throw err
      }

      res.type('text/css')
      res.send(css)
      res.send(200)
    })
}
github feross / studynotes.org / lib / builder.js View on Github external
fs.readFile(inFilename, { encoding: 'utf8' }, function (err, source) {
    if (err) return cb(err)
    stylus(source, { filename: inFilename })
      .include(nib.path)
      .define('cdnOrigin', config.cdnOrigin)
      .set('compress', config.isProd)
      .render(function (err, css) {
        if (err) return cb(err)
        fs.writeFile(outFilename, css, cb)
      })
  })
}
github csanz / node-expressjs-example / lib / boot.js View on Github external
function compile(str, path) {
    return stylus(str)
      .set('filename', path)
      .include(nib.path);
  }
github csanz / node-expressjs-example / lib / environments / development.js View on Github external
function compileStylus (str, path) {
    return stylus(str)
      .set('filename', path)
      .include(nib.path)
  }

nib

Stylus mixins and utilities

MIT
Latest version published 2 years ago

Package Health Score

57 / 100
Full package analysis

Popular nib functions