Skip to content

Instantly share code, notes, and snippets.

@primaryobjects
Last active August 29, 2015 14:16
Show Gist options
  • Save primaryobjects/b6b39aad7935d84a9308 to your computer and use it in GitHub Desktop.
Save primaryobjects/b6b39aad7935d84a9308 to your computer and use it in GitHub Desktop.
Razor Syntax for node.js views using Vash view engine.
Razor Syntax for node.js views
https://github.com/kirbysayshi/vash#syntax-example
Example Controller:
exports.page = function(req, res) {
res.render('page.vash', { name: 'John Doe', colors: [ 'red', 'green', 'blue' ] });
};
Example Views:
<!-- Layout: layout.vash -->
<html>
<body>
<hr/>
@html.block('content')
</body>
</html>
<!-- Partial View: page.vash -->
@html.extend('layout.vash', function(model) {
@html.block('content', function(model) {
<b>Hello World, @model.name!</b>
<p>
@for (var i in model.colors) {
<i>@model.colors[i]</i>
}
</p>
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment