base-engines
Adds support for managing template engines to your base application.
Last updated 8 years ago by jonschlinkert .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install base-engines 
SYNC missed versions from official npm registry.

base-engines NPM version NPM monthly downloads NPM total downloads Linux Build Status

Adds support for managing template engines to your base application.

Install

Install with npm:

$ npm install --save base-engines

Usage

Register the plugin with your base application:

var Base = require('base');
var engines = require('base-engines');
base.use(engines());

API

.engine

Register a view engine callback fn as ext. Calls .setEngine and .getEngine internally.

Params

  • exts {String|Array}: String or array of file extensions.
  • fn {Function|Object}: or settings
  • settings {Object}: Optionally pass engine options as the last argument.

Example

app.engine('hbs', require('engine-handlebars'));

// using consolidate.js
var engine = require('consolidate');
app.engine('jade', engine.jade);
app.engine('swig', engine.swig);

// get a registered engine
var swig = app.engine('swig');

.setEngine

Register engine ext with the given render fn and/or settings.

Params

  • ext {String}: The engine to set.

Example

app.setEngine('hbs', require('engine-handlebars'), {
  delims: ['<%', '%>']
});

.getEngine

Get registered engine ext.

Params

  • ext {String}: The engine to get.

Example

app.engine('hbs', require('engine-handlebars'));
var engine = app.getEngine('hbs');

About

Related projects

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Contributors

Commits Contributor
6 jonschlinkert
4 doowb

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. MIT


This file was generated by verb-generate-readme, v0.4.2, on February 21, 2017.

Current Tags

  • 0.2.1                                ...           latest (8 years ago)

4 Versions

  • 0.2.1                                ...           8 years ago
  • 0.2.0                                ...           8 years ago
  • 0.1.1                                ...           8 years ago
  • 0.1.0                                ...           8 years ago
Maintainers (2)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (3)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE