You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: _app/config.md
+65
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@ The options that can be passed into the Rendr App object.
15
15
-**notFoundHandler**_optional_ Callback for [Express.js not found errors](http://expressjs.com/guide/error-handling.html)
16
16
-**viewEngine**_optional_ Set a custom [Express.js ViewEngine](http://expressjs.com/api.html#app.engine)
17
17
-**viewsPath**_optional_ Override where the views are stored. This path is relative to `entryPath`. Default value is: `app/views`
18
+
-**baseLayoutName**_optional_ Set a custom name for the base template file of the app. For example `myLayout`. The default value is set to `__layout`.
18
19
19
20
Example configuration:
20
21
@@ -39,3 +40,67 @@ var config = {
39
40
40
41
rendr.createServer(config);
41
42
```
43
+
44
+
### Template Adapters
45
+
46
+
Provides a way for Rendr to utilize custom html template engines (see also Template Engines section below). Rendr's [ViewEngine](https://github.com/rendrjs/rendr/blob/master/server/viewEngine.js) will delegate to the [Template Adapter](https://github.com/rendrjs/rendr-handlebars/blob/master/index.js). You can build your own to provide your template engine of choice (i.e. Jade, Underscore templates, etc).
47
+
48
+
####Available Template Adapters
49
+
50
+
-[rendr-handlebars](https://github.com/rendrjs/rendr-handlebars) - [Handlebars.js](https://github.com/wycats/handlebars.js) support. This is the default adapter.
51
+
52
+
-[rendr-emblem](https://github.com/modalstudios/rendr-emblem) - [Emblem.js](https://github.com/machty/emblem.js/) with [Handlebars.js](https://github.com/wycats/handlebars.js) fallback support.
53
+
54
+
55
+
####Using Custom Adapters
56
+
57
+
You can tell Rendr which Template Adapter to use. This represents the node-module that contains the adapter.
58
+
59
+
```js
60
+
// /app/app.js
61
+
62
+
module.exports=BaseApp.extend({
63
+
defaults: {
64
+
templateAdapter:'rendr-emblem'
65
+
}
66
+
67
+
});
68
+
69
+
```
70
+
71
+
### Template Engines
72
+
73
+
While Template Adapters provide the layer of abstraction that allow you to use your favorite template engine in a Rendr app, the Template Engine option itself will tell the app which version to use exactly.
74
+
The default is set to be Handlebars, which is currently supported by the Rendr-handlebars adapter until version 2.0.0.
75
+
**When setting up your Rendr app, you'll need to add your Template Engine of choice to package.json.**
76
+
77
+
E.g.
78
+
79
+
```js
80
+
// /package.json
81
+
82
+
"dependencies": {
83
+
...
84
+
"express":"^4.12.0",
85
+
"handlebars":"^2.0.0"
86
+
"qs2":"~0.6.6",
87
+
...
88
+
},
89
+
90
+
```
91
+
92
+
####Using Custom Template Engines
93
+
94
+
You can tell Rendr which Template Engine to use. This represents the node-module that contains the engine.
0 commit comments