node.js jshtml-express layout

Hello!

Is there any way to have the master page or layout in jshtml?

I tried do this in .net Razor style, but it did't works. Link to jshtml view engine.

My intention is to have mastarpage lets say is called layout.jshtml and some other subpages like index.jshtml and so on, like it is in razor.

More explanation of what I mean speaking "I would like have masterpage" I have Layout.jshtml , this is my masterpage

<html>
<head>
    <link rel="stylesheet" href="/stylesheets/style.css" ></link>

</head>
<body>

@writeBody();




</body>
</html>

and I have other view called some.jshtml

<h1>@locals.title</h1>
<div class="Mydata">
@locals.content
@locals.otherContent
</div>

When I run this page in browser I would like to have concatenation of layout.jshtml and some.jshtml. The content of some.jshtml is rendered in writeBody(); in layout.jshtml

When I speaking of concatenation I mean someThing like this. This is result that I can see in browser.

<html>
<head>
    <link rel="stylesheet" href="/stylesheets/style.css" ></link>

</head>
<body>

<h1>title</h1>
<div class="Mydata">
content
otherContent
</div>

</body>
</html>

The jshtml repo links to the jshtml-express project.

The docs there give an example of how to use this in your project :

var express = require('express');

var port = parseInt(process.argv.pop());
var app = express();
app.configure(function() {
    app.use(express.bodyParser());
    app.use(app.router);
});

app.engine('jshtml', require('jshtml-express'));  // make sure you have installed via npm install jshtml-express
app.set('view engine', 'jshtml');

I have not used this myself, but the process is similar with other templating systems (Jade, Handlebars, etc).

More explanation of what I mean speaking "I would like have masterpage" I have Layout.jshtml , this is my masterpage

<html>
<head>
    <link rel="stylesheet" href="/stylesheets/style.css" ></link>

</head>
<body>

@writeBody();




</body>
</html>

and I have other view called some.jshtml

<h1>@locals.title</h1>
<div class="Mydata">
@locals.content
@locals.otherContent
</div>

When I run this page in browser I would like to have concatenation of layout.jshtml and some.jshtml. The content of some.jshtml is rendered in writeBody(); in layout.jshtml

When I speaking of concatenation I mean someThing like this. This is result that I can see in browser.

<html>
<head>
    <link rel="stylesheet" href="/stylesheets/style.css" ></link>

</head>
<body>

<h1>title</h1>
<div class="Mydata">
content
otherContent
</div>

</body>
</html>