Last active
August 29, 2015 14:16
-
-
Save primaryobjects/b6b39aad7935d84a9308 to your computer and use it in GitHub Desktop.
Razor Syntax for node.js views using Vash view engine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Layout: layout.vash --> | |
<html> | |
<body> | |
<hr/> | |
@html.block('content') | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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