Skip to content

Commit

Permalink
Update parse-time-evaluation.md
Browse files Browse the repository at this point in the history
  • Loading branch information
darnocian authored Oct 25, 2024
1 parent 5fa1dfb commit da2fa47
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/parse-time-evaluation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Copyright (c) 2019-2024 [Sempare Limited](http://www.sempare.ltd)

Parse time evaluation is different to normal template evaluation, as it allows for 'constant-like' variables to be substituted, and in some cases, expressions can be evalutated and some statements (if statements where the condition can be evaluated) can result in some template code being eliminated. It is a light weight pre-evaluation step in the template, which means the resulting template AST can be smaller.

Using the playpen, you can experiment by inspecting the pretty print tab and observing if you would benefit from enabling this feature.

Parse time evaluation is done by enabling the options eoEvalEarly and eoEvalVarsEarly in the _context_ options.

The requirement for parse time evaluation is that variables must be defined within the context. This is useful when you know certain information is _static_ and is unlikely to change.
Expand Down

0 comments on commit da2fa47

Please sign in to comment.