if (!set('partials'))
set('partials', function(){ return set('root') + '/views/partials' })
if (set('cache view partials'))
fs.readdirSync(set('partials')).each(function(file){
partialcache[file] = fs.readFileSync(file)
if (set('cache view partials')) {
var dir = set('partials')
fs.readdirSync(dir).each(function(file){
var fullpath = dir + '/' + file
partialcache[fullpath] = fs.readFileSync(fullpath)
})
}
// Request
Request.include({
* will have an object "video" available to it.
*
* @param {string} view
* @param {hash} options
* @settings 'partials', 'cache view partials'
* @return {string}
* @api public
*/
self.halt(200, content)
}
function renderFromDisc() {
if (partial)
return render( partialcache[path] || fs.readFileSync(path) )
return render(partialcache[path] || fs.readFileSync(path))
fs.readFile(path, function(err, content){
if (err) throw err
set('cache view contents')
? self.cache.set('view:' + path, content, function(cache){
render(cache)
})
: render(content)
})
}
if (set('cache view contents'))
if (!partial && set('cache view contents'))
self.cache.get('view:' + path, function(cache){
if (cache) return render(cache)
else return renderFromDisc()
})