html - CouchDB templating system: extend with separate footer & header -
i'm using couchdb\couchapp host web application. comes django, , jinja2 i'm able extend templates in 2 ways:
{% include "header.html" %}
or
{% extends "base.html" %} <<<---- preferred
i'm looking way same couchdb, have header , footer code written in every single page and, obv, doesn't best practice.
thank in advance.
couch db supports common js modules means can export mustache/or other templating library string , require in show function. more explanation on mail archive
if want use javascript on server side, you'll need store property on design doc. in "lib" folder (outside of _attachments) 'couchapp' included like:
couchapp folder
_id file
|_ _attachments folder
|_ ...clientside media...
|_ lib folder
|_ mustache.js
<---->
{_id:"", _attachments: {...}, lib:{mustache:""}}
then use in _show/_list/_update function
var mustache = require('lib/mustache')
. when need library both server , clientside 'couchapp', tend symlink appears in both _attachments , other properties.hope helps,
-natevw
Comments
Post a Comment