[6a3a178] | 1 | /*!
|
---|
| 2 | * Stylus
|
---|
| 3 | * Copyright (c) Automattic <developer.wordpress.com>
|
---|
| 4 | * MIT Licensed
|
---|
| 5 | */
|
---|
| 6 |
|
---|
| 7 | /**
|
---|
| 8 | * Module dependencies.
|
---|
| 9 | */
|
---|
| 10 |
|
---|
| 11 | var Renderer = require('./renderer')
|
---|
| 12 | , nodes = require('./nodes')
|
---|
| 13 | , utils = require('./utils');
|
---|
| 14 |
|
---|
| 15 | /**
|
---|
| 16 | * Export render as the module.
|
---|
| 17 | */
|
---|
| 18 |
|
---|
| 19 | exports = module.exports = render;
|
---|
| 20 |
|
---|
| 21 | /**
|
---|
| 22 | * Library version.
|
---|
| 23 | */
|
---|
| 24 |
|
---|
| 25 | exports.version = require('../package').version;
|
---|
| 26 |
|
---|
| 27 | /**
|
---|
| 28 | * Expose nodes.
|
---|
| 29 | */
|
---|
| 30 |
|
---|
| 31 | exports.nodes = nodes;
|
---|
| 32 |
|
---|
| 33 | /**
|
---|
| 34 | * Expose BIFs.
|
---|
| 35 | */
|
---|
| 36 |
|
---|
| 37 | exports.functions = require('./functions');
|
---|
| 38 |
|
---|
| 39 | /**
|
---|
| 40 | * Expose utils.
|
---|
| 41 | */
|
---|
| 42 |
|
---|
| 43 | exports.utils = require('./utils');
|
---|
| 44 |
|
---|
| 45 | /**
|
---|
| 46 | * Expose middleware.
|
---|
| 47 | */
|
---|
| 48 |
|
---|
| 49 | exports.middleware = require('./middleware');
|
---|
| 50 |
|
---|
| 51 | /**
|
---|
| 52 | * Expose constructors.
|
---|
| 53 | */
|
---|
| 54 |
|
---|
| 55 | exports.Visitor = require('./visitor');
|
---|
| 56 | exports.Parser = require('./parser');
|
---|
| 57 | exports.Evaluator = require('./visitor/evaluator');
|
---|
| 58 | exports.Normalizer = require('./visitor/normalizer');
|
---|
| 59 | exports.Compiler = require('./visitor/compiler');
|
---|
| 60 |
|
---|
| 61 | /**
|
---|
| 62 | * Convert the given `css` to `stylus` source.
|
---|
| 63 | *
|
---|
| 64 | * @param {String} css
|
---|
| 65 | * @return {String}
|
---|
| 66 | * @api public
|
---|
| 67 | */
|
---|
| 68 |
|
---|
| 69 | exports.convertCSS = require('./convert/css');
|
---|
| 70 |
|
---|
| 71 | /**
|
---|
| 72 | * Render the given `str` with `options` and callback `fn(err, css)`.
|
---|
| 73 | *
|
---|
| 74 | * @param {String} str
|
---|
| 75 | * @param {Object|Function} options
|
---|
| 76 | * @param {Function} fn
|
---|
| 77 | * @api public
|
---|
| 78 | */
|
---|
| 79 |
|
---|
| 80 | exports.render = function(str, options, fn){
|
---|
| 81 | if ('function' == typeof options) fn = options, options = {};
|
---|
| 82 | return new Renderer(str, options).render(fn);
|
---|
| 83 | };
|
---|
| 84 |
|
---|
| 85 | /**
|
---|
| 86 | * Return a new `Renderer` for the given `str` and `options`.
|
---|
| 87 | *
|
---|
| 88 | * @param {String} str
|
---|
| 89 | * @param {Object} options
|
---|
| 90 | * @return {Renderer}
|
---|
| 91 | * @api public
|
---|
| 92 | */
|
---|
| 93 |
|
---|
| 94 | function render(str, options) {
|
---|
| 95 | return new Renderer(str, options);
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | /**
|
---|
| 99 | * Expose optional functions.
|
---|
| 100 | */
|
---|
| 101 |
|
---|
| 102 | exports.url = require('./functions/url');
|
---|
| 103 | exports.resolver = require('./functions/resolver');
|
---|