Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

co-render

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

co-render

Thunk-based template rendering for Co and others

Source
npmnpm
Version
0.0.1
Version published
Weekly downloads
792
30.48%
Maintainers
1
Weekly downloads
 
Created
Source

co-render

Template rendering for co using consolidate.js, providing support for dozens of template engines.

Installation

$ npm install co-render

And install whichever engine(s) you use:

$ npm install ejs jade

Example

var co = require('co');
var render = require('co-render');

// swig mapped to .html

co(function *(){
  var user = {
    name: 'tobi',
    species: 'ferret'
  };


  var html = yield render('examples/user.html', { user: user, engine: 'swig' });
  console.log(html);
});

// jade, engine implied by extname

co(function *(){
  var user = {
    name: 'tobi',
    species: 'ferret'
  };


  var html = yield render('examples/user.jade', { user: user });
  console.log(html);
});

// ejs, engine implied by extname, with in-memory cache of the template function

co(function *(){
  var user = {
    name: 'tobi',
    species: 'ferret'
  };


  var html = yield render('examples/user.ejs', { user: user, cache: true });
  console.log(html);
});

License

MIT

Keywords

template

FAQs

Package last updated on 06 Sep 2013

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