🚀 Launch Week Day 4:Introducing the Alert Details Page: A Better Way to Explore Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

assemble-render-string

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assemble-render-string

Assemble plugin that adds a `.renderString` method for rendering a string with any registered engine.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

assemble-render-string NPM version Build Status

Assemble plugin that adds a .renderString method for rendering a string with any registered engine.

Install

Install with npm:

$ npm i assemble-render-string --save

Usage

var renderString = require('assemble-render-string');
var assemble = require('assemble');
var app = assemble();

app.use(renderString());

// optionally define the default engine to use
app.engine('txt', require('engine-base'));
app.use(renderString('txt'));

// render a string
var locals = { letter: 'B' };
app.renderString('A <%= letter %> C', locals, function(err, str) {
  if (err) throw err;
  console.log(str);
  //=> 'A B C'
});

API

.renderString

Render a string with the given locals and callback.

Params

  • string {String}: The string to render
  • locals {Object}: Locals to pass to the rendering engine.
  • callback {Function}

Example

var locals = {title: 'Foo'};
app.renderString('Name: <%= title %>', locals, function(err, str) {
  if (err) throw err;
  console.log(str);
  //=> 'Name: Foo'
});

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

This file was generated by verb on January 21, 2016.

Keywords

assemble

FAQs

Package last updated on 21 Jan 2016

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