Ind.ie is now Small Technology Foundation.
Commit 5fb273cf authored by Aral Balkan's avatar Aral Balkan

Implement partials cache

(Partials are only loaded from disk when first requested.)
parent bfa65175
......@@ -69,15 +69,16 @@ addPartials = (template) ->
tokenToReplace = match[0]
partialFilePath = path.join viewsPath, match[1]
console.log partialFilePath
partial = partialsCache[partialFilePath]
# cachedPartial = partialsCache[partialFilePath]
if partial == undefined
console.log "Loading partial #{partialFilePath}…"
partial = fs.readFileSync partialFilePath, 'utf8'
partialsCache[partialFilePath] = partial
else
console.log "Using partial from cache: #{partialFilePath}"
#partial = if cachedPartial != undefined then cachedPartial else fs.readFileSync partialFilePath, 'utf8'
partial = fs.readFileSync partialFilePath, 'utf8'
console.log partial
# console.log partial
template = template.replace (new RegExp tokenToReplace, 'g'), partial
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment