An OWIN-JS implementation of the Razor view template engine for the limerun project
npm install lime-razor




This is a simple razor view engine in Node.js javascript for OWIN-JS REST framework. It was created for the limerun project.
``js`
$ npm install lime-razor
This project, including documentation, was forked under MIT license from andyedinborough/RazorJS with various changes throughout to filename and package handling, and so that it that is easier to consume from OWIN-JS, Connect, Koa, and Express middleware.
To date, the raw parsing routines have not been adjusted materially from the RazorJS implementation.
A JavaScript implementation of the Razor view engine that aims to be simple and compatible for use both in the browser and in Node--simple enough for templating:
Razor.compile('hello @model.name')({ name: 'world' }) == 'hello world'
As well as a Node view-engine:
`js
// Dependencies
const lime = require('limerun')
, razor = require('lime-razor')
, router = require('lime-router')
, http = require('http');
// Initiate Factories
var route = router();
var app = new owin.app();
// Run Application
app.use(route);
route.get('/', function(){return razor.renderViewAsync(this, 'index.js.html');});
http.createServer(app.buildHttp()).listen(8000);
``
| Description | Code | Notes |
|---|---|---|
| Code Block |
| |
| Expression (Html Encoded) |
| |
| Expression (Unencoded) |
| |
| Combining Text and markup |
| |
| Mixing code and Plain text |
| |
| Mixing code and plain text (alternate) |
| |
| Email Addresses |
| Razor recognizes basic email format and is smart enough not to treat the @ as a code delimiter |
| Explicit Expression |
| In this case, we need to be explicit about the expression by using parentheses. |
| Escaping the @ sign |
| @@ renders a single @ in the response. |
| Server side Comment |
| |
| Mixing expressions and text |
| |
| Partials |
| |
| Layouts | View
Layout
|