RedHat-UX / red-hat-design-tokens

Red Hat design tokens
https://red-hat-design-tokens.netlify.app/
MIT License
14 stars 2 forks source link

[bug]: error on npm run start #85

Closed zeroedin closed 1 year ago

zeroedin commented 1 year ago

On branch [feat/add-new-gray](https://github.com/RedHat-UX/red-hat-design-tokens/tree/feat/add-new-grays)

Run npm run start

[11ty] File changed: css/global.css (skips build)
[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] 1. Having trouble rendering njk template ./docs/index.html (via TemplateContentRenderError)
[11ty] 2. (./docs/index.html)
[11ty]   EleventyShortcodeError: Error with Nunjucks shortcode `category` (via Template render error)
[11ty] 3. Cannot use 'in' operator to search for '$value' in null (via Template render error)
[11ty] 
[11ty] Original error stack trace: TypeError: Cannot use 'in' operator to search for '$value' in null
[11ty]     at /Users/sps/Sites/_rhds/red-hat-design-tokens/plugins/11ty.cjs:48:24

A fix seemingly seems to be checking if val === null in getFilePathGuess in plugins/11ty.cjs:48

/** Try to get the path to a token source file. Not all object values in a token collection have that metadata attached */
function getFilePathGuess(collection) {
  return Object.values(collection).reduce((path, val) =>
      path || typeof val !== 'object' || val === null ? path
            : '$value' in val ? val.filePath
            : getFilePathGuess(val), '');
}

Havent dug deep enough to validate if that is all that needs to be done or why we have a null val.

bennypowers commented 1 year ago

should be fixed by #83