CloudCannon / bookshop

📚 A component development workflow for static websites.
MIT License
249 stars 21 forks source link

Thought experiment: Better ergonomics for repeated input configurations #107

Open bglw opened 2 years ago

bglw commented 2 years ago

Envisioning the components:

# hero.bookshop.yml
blueprint:
  title: Hello World
  alignment: Left

_inputs:
  alignment:
    type: select
    options:
      values:
        - Left
        - Center
        - Right
# paragraph.bookshop.yml
blueprint:
  text: Hello World
  alignment: Left

_inputs:
  alignment:
    type: select
    options:
      values:
        - Left
        - Center
        - Right

Multiple components having to re-specify the select values for alignment is not ideal.

This could be solved currently by defining that input configuration, or indeed a _select_data array, in the site's global config. That, however, has the downside of making the components less portable since the bookshop no longer defines everything.

One could imaging an optional configuration file for the whole bookshop that can specify values to either merge into a global site config, or merge into all component structures.