Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/*!
* 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
}
.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) => {
/**
* 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);
/*!
* 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
}
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));
}
};
};
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));
.define('versionPath', function(urlPath) {
return new stylus.nodes.Literal('url(' + basic.versionPath(urlPath) + ')')
})
}
/**
* 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
*/
/**
* 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
.define('url', function (url) {
return new stylus.nodes.Literal('url(' + _this._resolveCssUrl(url.val, url.filename) + ')');
});
if (this._variables) {