Problem/Motivation

I originally though people would add Twig namespaces to label their entire component library. Which is why I used the term "component library" in many places in the code. But there's nothing in the code that limits developers. And my naming makes it seem like people are abusing the API. It's fine if someone wants to have a @form namespace that points to just their form-related components. And the code shouldn't be hinting at a limit that doesn't actually exist.

Proposed resolution

Rename "component-libraries" keyword in the theme/module yml files to just "components:namespaces".

Old way:

component-libraries:
  STARTERKIT:
    paths:
      - components
      - templates

New way:

components:
  namespaces:
    STARTERKIT:
      - components
      - templates

User interface changes

None.

API changes

We should allow the old "component-libraries" keyword for backwards compatibility.

CommentFileSizeAuthor
#3 3091762-2.patch1.35 KBjohnalbin

Comments

JohnAlbin created an issue. See original summary.

johnalbin’s picture

Issue summary: View changes

Updated new yml syntax so that it will work with other yml settings I'll be adding to the components module.

johnalbin’s picture

StatusFileSize
new1.35 KB

  • JohnAlbin committed 35f0741 on 8.x-2.x
    Issue #3091762 by JohnAlbin: Rename "component-libraries" key in info....
johnalbin’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

nikitas’s picture

i am using radix (4.10) and i had to remove component-libraries and add components instead:
Old way

component-libraries:
 namespaces:
   radix:
     paths:
       - ./src/components

New way

components:
 namespaces:
   radix:
     paths:
       - ./src/components
afsch’s picture

Regarding to #7, I think that works too. I also found a similar an approach in a different module https://www.drupal.org/project/radix/issues/3193046 (see the patch). It works as well.