ejs 流程
2020-04-09 17:31:51 0 举报
AI智能生成
ejs 源码逻辑
作者其他创作
大纲/内容
lib
ejs
export
render
options.cache
yes
options.filename
fn
cache[filename]
no
Error: cache need filename
options.__proto__ = options.locals
compile
str
compileDebug
__stack
catch error & rethrow
client
parse
options._with ? with(locals || {}) {function(){}} : ''
str traverse: stri
i += open.length
switch
=
-
default
');
; buf.push('
i+1
end < 0
throw Error
'-' == js[js.length-1]
协助删除尾部换行符
include
filename
throw error
include = read file
:
js = filtered(js)
%
buf.push('<%\
输出 <%
#
js = ''
注释
buf += prefixbuf += jsbuf += postfix
\\\\
\\\\\\\\
'
\\\\'
\
ignore
consumeEOL
consumeEOL = false
\\\
lineno++
buf += stri
renderFile
str = read(path)
filter
require('./filter')
cache
cache = {}
clearCache
function
filtered
rethrow
resolveInclude
utils
&
<
>
\"
0 条评论
回复 删除
下一页