11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.

Home Page:https://www.11ty.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Global eleventyComputed is out of sync

Apostolique opened this issue · comments

Describe the bug
It looks like eleventyComputed.js is executed out of sync.

To Reproduce
I have 4 files:

_data/eleventyComputed.js
a.njk
b.njk
c.njk

They have the following content:

// _data/eleventyComputed.js
module.exports = {
  eleventyComputed: {
    outputTest: data => data.page.outputPath
  }
};
<!-- a.njk, b.njk, c.njk -->
Output Path: {{ page.outputPath }}
Output Test: {{ outputTest }}

Running the eleventy CLI directly outputs:

_site/a/index.html
_site/b/index.html
_site/c/index.html

With this content:

<!-- _site/a/index.html -->
Output Path: _site/a/index.html
Output Test: 
<!-- _site/b/index.html -->
Output Path: _site/b/index.html
Output Test: _site/a/index.html
<!-- _site/c/index.html -->
Output Path: _site/c/index.html
Output Test: _site/b/index.html

Expected behavior
I would expect both page.outputPath and outputTest to have the same value. Also outputTest in _site/a/index.html is undefined.

Environment:

  • Windows
  • 0.12.1