Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#551 fix #634

Closed
octoxalis opened this issue Jul 28, 2019 · 4 comments
Closed

#551 fix #634

octoxalis opened this issue Jul 28, 2019 · 4 comments
Labels
Milestone

Comments

@octoxalis
Copy link

With 11ty 0.9.1-beta release to try, I had a glance at the source code to find a fix to my #551 issue .

Removing the empty template content test ( if (!this._templateContent) ) in templateContent getter function removes the error ( Template.js lines 450-459).

get templateContent() {
  if (!this._templateContent) {
    throw new TemplateContentPrematureUseError(
      `Tried to use templateContent too early (${this.inputPath} page ${this.pageNumber})`
    );
  }
  return this._templateContent;
}

Actually, is this content test necessary? Is there a reason to not simply return this._templateContent?

@zachleat
Copy link
Member

zachleat commented Aug 13, 2019

This error is required because it means that templateContent was referenced in a template before it was set by Eleventy! Though, hmm—maybe it needs to be === undefined instead? I can make that change to see if it helps you.

@zachleat
Copy link
Member

If this doesn’t help you (on 0.9.0-beta.2), I’ll need a reduced test case to move forward here!

@zachleat zachleat reopened this Aug 13, 2019
@zachleat zachleat added the pending Attempt fo fix applied, needs original poster to test. label Aug 13, 2019
@zachleat zachleat added this to the 0.9.0 milestone Aug 13, 2019
@octoxalis
Copy link
Author

The undefined test (if (this._templateContent === undefined ) ) is... fine!
I tried it and I've no more TemplateContentPrematureUseError.

@zachleat
Copy link
Member

zachleat commented Aug 17, 2019

Awesome! Thank you for testing! This will go out with 0.9.0 starting with beta 2

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

No branches or pull requests

2 participants