Skip to content
Myr

fixed register

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 065c37c · Browse files · 2 files+35 added−29 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+35 added−29 removed

  • other:+35 added−29 removed

2 files+35 added−29 removed

modified:lib/express/view/view.js+33 added
modified:lib/express/view.js+2 added-29 removed
34 unmodified lines
35exports = module.exports = View;36exports.Partial = Partial;3738/**39 * Register the given template engine `exports`40 * as `ext`. For example we may wish to map ".html"41 * files to jade:42 *43 * app.register('.html', require('jade'));44 *45 * This is also useful for libraries that may not46 * match extensions correctly. For example my haml.js47 * library is installed from npm as "hamljs" so instead48 * of layout.hamljs, we can register the engine as ".haml":49 *50 * app.register('.haml', require('haml-js'));51 *52 * For engines that do not comply with the Express53 * specification, we can also wrap their api this way.54 *55 * app.register('.foo', {56 * render: function(str, options) {57 * // perhaps their api is58 * // return foo.toHTML(str, options);59 * }60 * });61 *62 * @param {String} ext63 * @param {Object} obj64 * @api public39 * Export template engine registrar.40 */4167exports.register = function(ext, exports) {68 cache[ext] = exports;69};42exports.register = View.register;4344/**45 * Render `view` partial with the given `options`.46 *
200 unmodified lines