Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Precompilation and line endings in YTemplater #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

m4rc3iro
Copy link

Added information about how YTemplater makes use of line endings when precompiling template files.

This will help people to understand how YTemplater works and hopefully get ride of issues like the one described in #6.

@m4rc3iro
Copy link
Author

Updated the code example message to be more informative.

templateFn;

if (engineInfo.className === 'Y.Handlebars') {
templateFn = templater.revive(evalTemplateFunctionString(templateData.precompiled), templater.engine);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding templater.engine as the second argument doesn't make sense to me. Could you please explain?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit test failing was when running it under the Y.Handlebars engine.

In Y.Handlebars, the templater.revive method is overridden by the function template, were the environment variable is used to call methods like:

  • env.VM.checkRevision
  • env.VM.invokePartial
  • env.compile

All those methods are existing within the engine object itself, hence me passing it as parameter.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants