How to use the stylus.nodes 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 livereload / livereload-plugins / Stylus.lrplugin / node_modules / nib / lib / nib.js View on Github external
/*!
 * nib
 * Copyright (c) 2010 TJ Holowaychuk 
 * MIT Licensed
 */

/**
 * Module dependencies.
 */

var stylus = require('stylus')
  , nodes = stylus.nodes
  , utils = stylus.utils
  , Canvas

exports = module.exports = plugin;

// conditionally expose canvas-based APIs.

try {
  Canvas = require('canvas');

  var gradient = require('./nodes/gradient')
    , colorImage = require('./nodes/color-image')
} catch (err) {
  // ignore
}
github sagefy / sagefy / client / gulpfile.js View on Github external
.define('huslp', (h, s, l, a) => {  // eslint-disable-line max-params, max-len
                const [r, g, b] = husl.p.toRGB(h.val, s.val, l.val)
                a = a || 1
                return new stylus.nodes.RGBA(r * 255, g * 255, b * 255, a)
            })
            .render((err, css) => {
github mijia / gobuildweb / assets / stylus-assets.js View on Github external
/**
 * Created by lengbing on 15/9/15.
 */
/**
 * Stylus Plugin for use asset_map in *.styl
 */

var stylus = require('stylus'),
    path   = require('path'),
    nodes = stylus.nodes;


// `process.cwd()` is the project root path here

var jsonFile = path.join(process.cwd(), './assets_map.json');
var list = require(jsonFile);



/**
 * add custom functions
 * @returns {Function}
 */
function plugin(){
    return function(style){
        style.define('assets', assets);
github colorjs / rainbowbot / node_modules / nib / lib / nib.js View on Github external
/*!
 * nib
 * Copyright (c) 2010 TJ Holowaychuk 
 * MIT Licensed
 */

/**
 * Module dependencies.
 */

var stylus = require('stylus')
  , nodes = stylus.nodes
  , utils = stylus.utils
  , Canvas

exports = module.exports = plugin;

// conditionally expose canvas-based APIs.

try {
  Canvas = require('canvas');

  var gradient = require('./nodes/gradient')
    , colorImage = require('./nodes/color-image')
} catch (err) {
  // ignore
}
github ksc-fe / kpc / components / grid / mediaQueryForStylus.js View on Github external
var breakpoints = require('./mediaQuery');
var stylus = require('stylus');
var nodes = stylus.nodes;

module.exports = function() {
    return function(style) {
        for (var key in breakpoints) {
            style.define(key, (function(key) {
                return function() {
                    return new nodes.Unit(parseInt(breakpoints[key], 10), 'px')
                }
            })(key));
        }
    };
};
github boronine / colorspaces.js / colorspaces.js View on Github external
return function (a, b, c) {
                var g = void 0,
                    r = void 0;
                var foo = converter(space, 'sRGB');
                var rgb = sRGB_prepare(foo([a.val, b.val, c.val]));
                return new stylus.nodes.RGBA(rgb[0], rgb[1], rgb[2], 1);
              };
            }(space));
github serby / versionator / examples / express / app.js View on Github external
.define('versionPath', function(urlPath) {
        return new stylus.nodes.Literal('url(' + basic.versionPath(urlPath) + ')')
      })
  }
github aredotna / ervell / node_modules / nib / lib / nodes / color-image.js View on Github external
/**
 * Module dependencies.
 */

var stylus = require('stylus'),
    Canvas = require('canvas'),
    nodes = stylus.nodes,
    utils = stylus.utils;

/**
 * Expose `ColorImage`.
 */

exports = module.exports = ColorImage;

/**
 * Create a new `ColorImage` node with the given `color`.
 *
 * @param {Color} color node
 * @return {ColorImage}
 * @api public
 */
github aredotna / ervell / node_modules / nib / lib / nodes / gradient.js View on Github external
/**
 * Module dependencies.
 */

var stylus = require('stylus'),
    Canvas = require('canvas'),
    nodes = stylus.nodes,
    utils = stylus.utils;

/**
 * Expose `Gradient`.
 */

exports = module.exports = Gradient;

/**
 * Create a new `Gradient` node with the given `size`
 * and `start` position.
 *
 * @param {Number} size
 * @param {String|Ident|Literal} start
 * @return {Gradient}
 * @api public
github enb / enb / techs / css-stylus.js View on Github external
.define('url', function (url) {
                return new stylus.nodes.Literal('url(' + _this._resolveCssUrl(url.val, url.filename) + ')');
            });
        if (this._variables) {