There are two ways to pass data to the templates: 1) with _data.json and 2) with _harp.json. See the examples below for the correct way of doing it.
/node_modules
/public
/_data.json
/_harp.json
/index.jade
/package.json
/server.js
| { | |
| "index": { | |
| "title": "Hello World" | |
| } | |
| } |
| { | |
| "globals": { | |
| "foo": "bar" | |
| } | |
| } |
| h1= title | |
| h2= foo |
| { | |
| "dependencies": { | |
| "express": "3.x", | |
| "harp": "0.10.x" | |
| } | |
| } |
| var express = require("express"); | |
| var harp = require("harp"); | |
| var app = express(); | |
| app.configure(function(){ | |
| app.use(express.static(__dirname + "/public")); | |
| app.use(harp.mount(__dirname + "/public")); | |
| }); | |
| app.listen(9001); |