Skip to content

Blueprint for Pattern Lab’s Internal Plumbing? #1031

@sghoweri

Description

@sghoweri

In my opinion, I think we should take a step back to make sure we understand all the different ways that Pattern Lab should be able to be configured / customized in order to be suitably flexible for a huge range of use cases and diverse needs.

Step 1. Configure

Ignoring X ticket for a moment, I think we can boil things down into the 3 high level ways that Patterns themselves should be able to get configured:

  1. Via the physical structure and names of folders / files
  2. Via pattern-specific configs
    1. JSON
    2. YAML
    3. Markdown front matter
    4. JavaScript?
  3. Via a global config file (basically allow the first two layers to be overwritten)
    1. JSON
    2. JavaScript / .rc config, etc

Step 2. Aggregate

Without diving into the specifics, each one of these layers of data gets created via some under the hood processes (ex. recursively walking through the file system).

Ultimately, we end up with up to 3 layers of data that get merged together — this represents what we want Pattern Lab to look like, how we want the navigation to be named and structured, what components need to get compiled into HTML, etc.

^ basically we end up with a blueprint of what and where things need to get compiled and how we want things structured.

This step includes things like:

  • Generating the final data that’ll get used to compile a particular template
  • Generate the data that powering PL’s navigation
  • Generate the data that powers PL’s search

Step 3. Compile

The last major step (as I see it) is to take the blueprint of what we want to build and to actually compile all the different parts that comprise Pattern Lab:

This includes things like:

  • Compile all the different templating languages for the different templates found into HTML
  • Outputting those compiled templates onto the file system in a place that PL knows where to find it

I know I’m glazing over a few details, however when I hear about bugs like the “Viewall Bug” or see incoming breaking changes like removing file / folder prefix support, I find myself asking the question:

What’s broken / what’s changing in this simplified architecture?

  • Is it how we implicitly / explicitly configure PL?
  • Is it how we gather up + mix and match the data from these different locations?
  • Or is it how we take the final blueprint of what we want and compile the final static site?

One thing in particular I’d really like to sketch out is what are all the different ways the file system / folder configuration approach gets used:

For example:

_patterns/
  atoms/
    button/
      button.twig
  molecules/
    card/
      card.twig
_patterns/
  atoms/
    button/
      button.twig
    card.twig
_patterns/
  atoms/
    button.twig
    card.twig
_patterns/
  overview.twig
_patterns/
  overview.twig
  atoms/
    button.twig
    card.twig

Taking a step back and coming up with a physical JSON or YAML schema that describes how each component’s internal PL metadata is structured seems like a reasonable place to start.

There’s lots more for me to dig into to make sure Pattern Lab is as flexible and stable as possible!

Metadata

Metadata

Assignees

No one assigned

    Labels

    pinned 📌Don't let stalebot clean this up

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions