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

engine-base

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

engine-base

Default engine for Template.

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
30K
increased by1.88%
Maintainers
1
Weekly downloads
 
Created
Source

engine-base NPM version

Default engine for Template.

Install

Install with npm

$ npm i engine-base --save

Usage

var engine = require('engine-base');

API

compileSync

Return a compiled function from the given template string and options.

Params

  • str {String}: Template string to compile.
  • options {Object}: Options or settings to pass to base
  • returns {Function}

Example

var engine = require('engine-base');
var fn = engine.compileSync('<%= name %>');
console.log(fn({name: 'Halle'})); //=> 'Halle'

compile

Return a compiled function from the given template string and options can callback

Params

  • str {String}: Template string to compile.
  • options {Object}: Options or settings to pass to engine.
  • cb {Function}: Callback function

Example

var engine = require('engine-base');
engine.compile('<%= name %>', function (err, fn) {
  console.log(fn({name: 'Halle'})); //=> 'Halle'
});

renderSync

Render templates synchronously.

Params

  • str {Object}: The string to render.
  • options {Object}: Object of options.
  • returns {String}: Rendered string.

Example

var engine = require('engine-base');
engine.renderSync('<%= name %>', {name: 'Halle'});
//=> 'Halle'

render

String support. Render the given str and invoke the callback callback(err, str).

Params

  • str {String}
  • locals {Object|Function}: or callback.
  • callback {Function}

Example

var engine = require('engine-base');
engine.render('<%= name %>', {name: 'Jon'}, function (err, content) {
  console.log(content); //=> 'Jon'
});

renderFile

File support. Render a file at the given filepath and callback callback(err, str).

Params

  • path {String}
  • options {Object|Function}: or callback function.
  • callback {Function}

Example

var engine = require('engine-base');
engine.renderFile('foo/bar/baz.tmpl', {name: 'Halle'});
//=> 'Halle'
  • engine-cache: express.js inspired template-engine manager. | homepage
  • engine-handlebars: Handlebars engine, consolidate.js style but with enhancements. This works with Assemble, express.js, engine-cache or any… more | homepage
  • engine-less: Consolidate-style engine for rendering .less files. | homepage
  • engine-lodash: Lo-Dash engine, consolidate.js style but with enhancements. Works with Assemble, express.js, engine-cache or any application… more | homepage
  • helper-cache: Easily register and get helper functions to be passed to any template engine or node.js… more | homepage
  • template: Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template… more | homepage
  • template-helpers: Generic JavaScript helpers that can be used with any template engine. Handlebars, Lo-Dash, Underscore, or… more | homepage

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 © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on September 08, 2015.

FAQs

Package last updated on 08 Sep 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