Problem/Motivation

i want to be able to set namespaces for components in the *.info.yml files, like i can do for other twig templates

Steps to reproduce

After editing my themes info.yml file to this:

components:
  namespaces:
    theme_templates:
      - templates
    theme_components:
      - components

i can use this include with templates, but not with components
{% include '@theme_templates/components/icon/icon.twig' %} works
{% include 'theme_name:icon' %} works
{% include '@theme_components:icon' %} does not work
{% include 'theme_components:icon' %} does not work

Proposed resolution

make SDC respect and use component namespaces that is already in use

Comments

Anskelt created an issue. See original summary.

larowlan’s picture

The info.yml functionally is provided by components module in contrib, so should this issue be filed there?

anskelt’s picture

That could be the case, i thought since we seem to not use the file in SDC, it could be on our part the problem exists.

kristen pol’s picture

We don't want to get this into core so we don't have to use the components module anymore?

When pulling in UI Kits from outside of Drupal, allowing for namespaces is very important.

quietone’s picture

Project: Drupal core » Components
Version: 10.3.x-dev »
Component: single-directory components » Code

Changing project per comment #2.

quietone’s picture

Project: Components » Components!
Version: » 3.1.0
johnalbin’s picture

Status: Active » Closed (works as designed)

SDC doesn't use Twig namespaces. Its API is better than Components' API, IMO.

SDC uses [theme name]:[component name]. As you can see it just uses theme name and component name, and not any Twig namespace. Since it doesn't use Twig namespaces, there is nothing for it to respect.

And since the Components module only affects Twig namespaces, it can't alter how SDC works.

These two APIs are independent of each other and can work simultaneously in a single theme without conflicting with each other.

The examples that "don't work" in the original post are examples of the user not following either API.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.