Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

engine-cache

Package Overview
Dependencies
Maintainers
2
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

engine-cache

express.js inspired template-engine manager.

  • 0.10.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
33K
increased by18.15%
Maintainers
2
Weekly downloads
 
Created
Source

engine-cache NPM version

express.js inspired template-engine manager.

Install with npm

npm i engine-cache --save

Usage

var Engines = require('engine-cache');

API

Engines

  • engines {Object}: Optionally pass an object of engines to initialize with.
var Engines = require('engine-cache');
var engines = new Engines();

.setEngine

Register the given view engine callback fn as ext.

  • ext {String}
  • options {Object|Function}: or callback fn.
  • fn {Function}: Callback.
  • returns {Object} Engines: to enable chaining.
var consolidate = require('consolidate')
engines.setEngine('hbs', consolidate.handlebars)

.getEngine

Return the engine stored by ext. If no ext is passed, the entire cache is returned.

  • ext {String}: The engine to get.
  • returns {Object}: The specified engine.
var consolidate = require('consolidate')
engine.setEngine('hbs', consolidate.handlebars);

engine.getEngine('hbs');
// => {render: [function], renderFile: [function]}

.load

Load an object of engines onto the cache. Mostly useful for testing, but exposed as a public method.

  • obj {Object}: Engines to load.
  • returns {Object} Engines: to enable chaining.
engines.load(require('consolidate'))

.helpers

Get and set helpers for the given ext (engine). If no ext is passed, the entire helper cache is returned.

  • ext {String}: The helper cache to get and set to.
  • returns {Object}: Object of helpers for the specified engine.

Example:

var helpers = engines.helpers('hbs');
helpers.addHelper('foo', function() {});
helpers.getHelper('foo');
helpers.getHelper();

See helper-cache for any related issues, API details, and documentation.

.clear

Remove ext engine from the cache, or if no value is specified the entire cache is reset.

  • ext {String}: The engine to remove.

Example:

engines.clear()
  • helper-cache: Easily register and get helper functions to be passed to any template engine or node.js application. Methods for both sync and async helpers.
  • async-helpers: Use async helpers in template engines like Handlebars and Lodash.
  • template: Render templates from any engine. Make custom template types, use layouts on pages, partials or any custom template type, custom delimiters, helpers, middleware, routes, loaders, and lots more. Powers Assemble v0.6.0, Verb v0.3.0 and your application.
  • template-helpers: Generic JavaScript helpers that can be used with any template engine. Handlebars, Lo-Dash, Underscore, or any engine that supports helper functions.
  • handlebars-helpers: 120+ Handlebars helpers in ~20 categories, for Assemble, YUI, Ghost or any Handlebars project. Includes helpers like {{i18}}, {{markdown}}, {{relative}}, {{extend}}, {{moment}}, and so on.

Running tests

Install dev dependencies:

npm i -d && npm test

Contributing

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

Author

Jon Schlinkert

License

Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license


This file was generated by verb-cli on April 01, 2015.

Keywords

FAQs

Package last updated on 01 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc