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

masonry

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

masonry

Templating middleware for embedded javascript templates.

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
397
decreased by-21.85%
Maintainers
1
Weekly downloads
 
Created
Source

###Masonry - Templating middleware for embedded javascript templates.
Install: npm install masonry


###masonry(directory):
Pass a directory of templates. Masonry will read all of the template files into memory. ###res.render('template.ejs', data)
Method added by the middleware. Renders a template. If a third parameter (callback) is provided the data will be returned rather than sent to the browser. The first param will be an error object, the second will be the rendered html.

var app = require('express').createServer()
var masonry = require('masonry')

app.use(masonry(__dirname + '/templates'))

app.get('/:user', function(req, res) {
  res.render('index.ejs', {user: req.params.user})
})

app.get('/return/:user', function(req, res) {
  res.render('index.ejs', {user: req.params.user}, function(err, html){
    if(err) throw new Error(err)
    res.end(html)
  })
})

app.listen(3000)

###Deps: EJS documentation: https://github.com/visionmedia/ejs


###Examples: View the examples


###Tests

npm test

Build Status

Keywords

FAQs

Package last updated on 23 May 2012

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