Merge pull request #304 from sharelatex/ho-jade-speedup

Ho jade speedup
This commit is contained in:
Henry Oswald 2016-08-30 12:47:08 +01:00 committed by GitHub
commit 8c18153d5c

View file

@ -25,14 +25,14 @@ module.exports = Modules =
for module in @modules
for view, partial of module.viewIncludes or {}
@viewIncludes[view] ||= []
@viewIncludes[view].push fs.readFileSync(Path.join(MODULE_BASE_PATH, module.name, "app/views", partial + ".jade"))
@viewIncludes[view].push jade.compile(fs.readFileSync(Path.join(MODULE_BASE_PATH, module.name, "app/views", partial + ".jade")), doctype: "html")
moduleIncludes: (view, locals) ->
partials = Modules.viewIncludes[view] or []
compiledPartials = Modules.viewIncludes[view] or []
html = ""
for partial in partials
compiler = jade.compile(partial, doctype: "html")
html += compiler(locals)
for compiledPartial in compiledPartials
d = new Date()
html += compiledPartial(locals)
return html
moduleIncludesAvailable: (view) ->