__express = function (path, options, fn) { if(options.compileDebug == undefined && process.env.NODE_ENV === 'production') { options.compileDebug = false; } exports.renderFile(path, options, fn); }
n/a
compile = function (str, options){ var options = options || {} str = String(str); var parsed = compileBody(str, { compileDebug: options.compileDebug !== false, filename: options.filename, basedir: options.basedir, pretty: options.pretty, doctype: options.doctype, inlineRuntimeFunctions: options.inlineRuntimeFunctions, globals: options.globals, self: options.self, includeSources: options.compileDebug === true, debug: options.debug, templateName: 'template' }); var res = options.inlineRuntimeFunctions ? new Function('', parsed.body + ';return template;')() : runtimeWrap(parsed.body); res.dependencies = parsed.dependencies; return res; }
n/a
compileClient = function (str, options) { return exports.compileClientWithDependenciesTracked(str, options).body; }
n/a
compileClientWithDependenciesTracked = function (str, options){ var options = options || {}; str = String(str); var parsed = compileBody(str, { compileDebug: options.compileDebug, filename: options.filename, basedir: options.basedir, pretty: options.pretty, doctype: options.doctype, inlineRuntimeFunctions: options.inlineRuntimeFunctions !== false, globals: options.globals, self: options.self, includeSources: options.compileDebug, debug: options.debug, templateName: options.name || 'template' }); return {body: parsed.body, dependencies: parsed.dependencies}; }
n/a
compileFile = function (path, options) { options = options || {}; options.filename = path; return handleTemplateCache(options); }
n/a
compileFileClient = function (path, options){ var key = path + ':client'; options = options || {}; options.filename = path; if (options.cache && exports.cache[key]) { return exports.cache[key]; } var str = fs.readFileSync(options.filename, 'utf8'); var out = exports.compileClient(str, options); if (options.cache) exports.cache[key] = out; return out; }
...
var jade = require('./');
var resolvedJade = require.resolve('./');
function compileTemplate(module, filename) {
var template = jade.compileFileClient(filename, {inlineRuntimeFunctions: false});
var body = "var jade = require('" + resolvedJade + "').runtime;\n\n" +
"module.exports = " + template + ";";
module._compile(body, filename);
}
if (require.extensions) {
require.extensions['.jade'] = compileTemplate
...
render = function (str, options, fn){ // support callback API if ('function' == typeof options) { fn = options, options = undefined; } if (typeof fn === 'function') { var res try { res = exports.render(str, options); } catch (ex) { return fn(ex); } return fn(null, res); } options = options || {}; // cache requires .filename if (options.cache && !options.filename) { throw new Error('the "filename" option is required for caching'); } return handleTemplateCache(options, str)(options); }
n/a
renderFile = function (path, options, fn){ // support callback API if ('function' == typeof options) { fn = options, options = undefined; } if (typeof fn === 'function') { var res try { res = exports.renderFile(path, options); } catch (ex) { return fn(ex); } return fn(null, res); } options = options || {}; options.filename = path; return handleTemplateCache(options)(options); }
n/a