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

express-partials

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-partials - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

.travis.yml

7

History.md

@@ -0,1 +1,8 @@

0.0.6 / 2012-09-10
==================
* Added tests and fixes for layout path resolution. (thanks to Jakub Nešetřil @zzen)
* Added Travis-CI.
0.0.5 / 2012-06-29

@@ -2,0 +9,0 @@ ==================

7

index.js

@@ -5,2 +5,3 @@ var path = require('path')

, resolve = path.resolve
, dirname = path.dirname
, extname = path.extname

@@ -64,3 +65,7 @@ , basename = path.basename;

var ext = extname(name) || '.'+(res.app.get('view engine') || 'ejs');
_render(basename(layout,ext)+ext, options, fn);
var root = req.app.get('views') || process.cwd() + '/views';
var dir = dirname(name) == '.' ? root : resolve(root,dirname(name));
layout = dirname(lookup(dir, layout, ext))+(path.sep||'/')+basename(layout,ext)+ext;
_render(layout, options, fn);
})

@@ -67,0 +72,0 @@

2

package.json

@@ -5,3 +5,3 @@ {

"description": "Express 3.x Layout & Partial support.",
"version": "0.0.5",
"version": "0.0.6",
"repository": {

@@ -8,0 +8,0 @@ "url": "https://github.com/publicclass/express-partials"

@@ -0,1 +1,2 @@

[![build status](https://secure.travis-ci.org/publicclass/express-partials.png)](http://travis-ci.org/publicclass/express-partials)
# express-partials

@@ -2,0 +3,0 @@

@@ -45,2 +45,11 @@ var express = require('express')

app.get('/subdir',function(req,res,next){
res.render('subdir/index.ejs')
})
app.get('/subdir-explicit',function(req,res,next){
res.render('subdir/index.ejs', {layout: 'subdir/layout.ejs', list:[{name:'one'},{name:'two'}]})
})
/* Use `register` to substitute the file extension. */

@@ -249,3 +258,27 @@ app.engine('.j',require('jade').__express);

})
describe('GET /subdir',function() {
it('should render index.ejs with layout.ejs (both inside subdir)', function(done) {
request(app)
.get('/subdir')
.end(function(res) {
res.should.have.status(200);
res.body.should.equal('<html><title>subdir layout</title><body><h2>Hello World</h2></body></html>');
done();
})
})
})
describe('GET /subdir-explicit',function() {
it('should render index.ejs with layout.ejs (both inside subdir) when layout is specified in locals', function(done) {
request(app)
.get('/subdir-explicit')
.end(function(res) {
res.should.have.status(200);
res.body.should.equal('<html><title>subdir layout</title><body><h2>Hello World</h2></body></html>');
done();
})
})
})
})
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