New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-dynamic-partials

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-dynamic-partials

render partials server side

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

express-dynamic-partials

NPM Version NPM Downloads Node.js Version Build Status Coverage Status Gittip

Dynamically render partials server-side. Works with any view engine, eg ejs, jade, etc.

Add it as middleware:

var app = express();
var partials = require('express-dynamic-partials');
app.locals.basedir = __dirname + '/partials');
app.use('/render', partials(app.locals.basedir, 'jade'));

Supports any view engine:

app.use('/render', partials(app.locals.basedir, 'ejs'));

If no view engine is specified, it will use the app's view engine:

app.set('view engine', 'ejs');
app.use('/render', partials(app.locals.basedir)); // will use ejs

Create a partial:

/partials
  /my-partial.jade
h1= text

Dynamically render the partial:

curl localhost:3000/render/my-partial?text=hello

Returns:

<h1>hello</h1>

Installation

$ npm install express-dynamic-partials
var app = express();
var partials = require('express-dynamic-partials');
app.locals.basedir = __dirname + '/partials');
app.use('/render', partials(app.locals.basedir, 'jade'));

MIT Licensed

Keywords

FAQs

Package last updated on 04 Sep 2014

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