Why not use namespaces?

Created on 18 September 2024, 3 months ago

Problem

Why are we not using namespaces for components? Was there some technical limitation of being able to include CSS and JS with component if we reference TWIG file?

I am asking, because I can't set up my IDE to have autocomplete and jumping from component use to component directory directly. With namespaces defined this line {{ include('@theme-name/components/atom/text/heading.html.twig') }} would be autocomplete, I just start typing `hea...` and get the whole path to file, also I can click on any part and get to right directory, be it `components`, `atom` or `text`. From there I can jump to any embedded or included components and so on and on. With proposed way of doing includes `{{ include('sdc_examples:my-button') }}` none of this is possible (or I can't see how to set it up), and I have to keep hundreds of component and variation names in memory.

Maybe it would be cool to use component *.component.yml file as *.libraries.yml, extend that libraries file format to include what we need, then reference it in TWIG as per usual, like {{ attach_library('sdc_examples/my-button') }} and we would get CSS and JS files from there and we could reference components by TWIG files and have all the TWIG infrastructure usable? None of this is any technical, just ramblings at the moment, but I can see these styles of includes as a hurdle to adoption of single-directory components.

💬 Support request
Status

Active

Version

11.0 🔥

Component
single-directory components 

Last updated about 8 hours ago

Created by

🇱🇻Latvia mansspams

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024