Skip to content

Not having a user-defined header & footer throws lots of errors #418

Closed
@geoffp

Description

@geoffp

I am using Pattern Lab Node v2.3.0 on Mac, with Node v4.4.7, using the Gulp Edition.

Expected Behavior

Code comments refer to the user-defined header & footer as optional. If that's still correct, and I choose not to have a user-defined header & footer, Pattern Lab should run without mysterious error messages. Maybe it's more correct, though, to say the "user-defined" header and footer are required (since they are included by default in the editions), and refuse to continue the build if we do not find them, reporting the error clearly.

Actual Behavior

If your header & footer aren't found, we get lots of this barfed out:

e =  [TypeError: Invalid template! Template should be a "string" but "undefined" was given as the first argument for mustache#render(template, view, partials)]

It seems that when we get to ui_builder.js:453:

var headerHTML = pattern_assembler.renderPattern(patternlab.userHead, {
  patternLabHead : headerPartial
});

patternlab.userHead is undefined, because it was never loaded from the filesystem. The error message that would explain this is currently hidden by default behind the debug flag.

Steps to Reproduce

This happened to me during a Pattern Lab 1.X -> 2.X migration, in which my path to the _meta directory was set incorrectly, so I propose that we make handling of this case clearer to assist people with migration errors.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions