Skip to content

Commit

Permalink
basic readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
mcwhittemore committed May 23, 2013
1 parent c82146a commit 9984d4c
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions README.md
@@ -0,0 +1,65 @@
# EJS Layouts

`EJS Layouts` aims to add layout capibilities to frameworks for ejs.

## Install

```
npm install ejs-layouts
```

## Usage

**Layout.ejs**

```html
<html>
<head>
<title><%- title %></title>
<body>
<%- content %>
</body>
</html>
```

**Home.ejs**

<div>
<%- name %>! Welcome to my site!
</div>

### Express

```
var express = require('express')
var ejs_layout = require('ejs-layouts');
var app = express();
app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(ejs_layout.express);
app.use(app.router);
});
server.listen(3000);
app.get('/', function(req, res) {
res.layout('Layout', {title:"Homepage"}, {content:{block:"Home", data:{name:"Matthew"}}});
});
```

**Result**

```
<html>
<head>
<title>Homepage</title>
<body>
<div>
Matthew! Welcome to my site!
</div>
</body>
</html>
```

0 comments on commit 9984d4c

Please sign in to comment.