[META] Create Single Directory Components for the Olivero theme

Created on 4 June 2023, over 1 year ago

Problem/Motivation

As part of our roadmap to stable ( 🌱 Single Directory Components module roadmap: the path to beta and stable Active ), we want to include some Single Directory Components into Drupal core's front-end facing themes.

Let's have this issue to track all the efforts in this direction. Ideally, we'll have one issue per attempted component linked as a children to this one.

Implementation Instructions

  1. Create a new issue for Drupal core β†’ with the title: Create new SDC component for Olivero (name). Make sure to change name to the actual component's name.
  2. Paste the Component Issue Template, and fill in the specifics about the chosen component.
  3. Add the SDC Sprint DrupalConNA 2023 tag to the issue, if you are creating it during DrupalConNA 2023.
  4. Add the newly create issue as a child of this issue. And leave a comment here.

Component Issue Template

<pre>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
Single directory components (SDC) is a new way to theme Drupal. Instead of scattering related files around your theme, they're contained to one directory. The primary issue for SDC is at 
            
              
              
              ✨
              Single directory components in core
                Active
              
            .

This issue is postponed on 
            
              
              
              πŸ“Œ
              Move code from the experimental SDC module to core
                Fixed
              
            , since we cannot make Olivero depend on an experimental module. In any case, this issue can (and should) be worked in parallel.

<h4><em>Name</em> component</h4>

As part of SDC's roadmap (see 
            
              
              
              🌱
              Single Directory Components module roadmap: the path to beta and stable
                Active
              
            ), we want to convert Olivero components to use SDC. For this task I'm choosing the <em>Name</em> component, which includes markup, CSS, and JS.

This component is a good fit because: <em>enter details</em>

This component involves the following Twig templates, CSS, JS, assets, and libraries:

<ol>
  <li><em>List involved files and systems here</em></li>
</ol>

<h3>Testing instructions</h3>

<ol>
  <li><em>Add testing instructions here.</em></li>
  <li><em>Point out any automated tests that cover this component's refactor.</em></li>
</ol>
</pre>
🌱 Plan
Status

Active

Version

10.1 ✨

Component
OliveroΒ  β†’

Last updated about 3 hours ago

Created by

e0ipso Can Picafort

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

Comments & Activities

  • Issue created by @e0ipso
  • e0ipso Can Picafort

    I added the, previously existing issue, πŸ“Œ Create new SDC component for Olivero (tabs) Postponed as a child to this one.

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels
  • πŸ‡¨πŸ‡¦Canada xmacinfo Canada

    Any dependency between Olivero and SDC must be optional so that a user is not obligated to enable SDC just to use Olivero or take Olivero as a base theme.

  • πŸ‡¨πŸ‡¦Canada xmacinfo Canada

    I'd prefer that you create a clone of Olivero rather than force Olivero to use SDC.

  • πŸ‡¨πŸ‡¦Canada xmacinfo Canada

    As I mentioned in other SDC issues, SDC should always be optional and not enabled by default by any existing core theme or core modules.

  • πŸ‡¨πŸ‡¦Canada xmacinfo Canada

    As I mentioned in another ticket, when using Olivero as a base theme, will we be able to remove some or all SDC components and replace those with regular Twig templates?

    In general SDC components are welcome. But I still expect to use the current theme layer as is, even if I use Olivero as a base theme. We may still built themes with or without SDC components. But if Olivero is forcing us to use SDC, some of us will not be able to use Olivero as a base theme.

  • e0ipso Can Picafort

    @xmacinfo it was decided, a long time ago, that single directory components are the way to approach components in Drupal core, and that core will recommend this approach for contrib, and custom modules and themes. This decision is beyond the scope of this ticket and can be reviewed at length in ✨ Single directory components in core Active and ✨ Add Single Directory Components as a new experimental module Fixed . If you disagree, or want to revise this decision, please open a new issue with that as it's clear goal. I will be happy to engage there as well.

    However, since I don't want to leave you hanging until that issue happens (or not), I will address your comments here.

    With that context in mind:

    I'd prefer that you create a clone of Olivero rather than force Olivero to use SDC.

    If Olivero is to benefit from components, it shoudl do so by using SDC (as per the decision above). We can argue weather or not Olivero benefits from components, this would definitely be in scope for this issue. I do believe it does, but I think Olivero maintainers like @mherchel can elaborate better on this, since he has already given his go ahead on this.

    With regards to creating a clone, I don't think it's feasible to maintain two exact themes in core, but again this is a conversation to be had with others since I will not be on the hook for maintaining this hypothetical clone.

    As I mentioned in other SDC issues, SDC should always be optional and not enabled by default by any existing core theme or core modules.

    I see in our profiles that English is not the first language of either of us. I am interpreting the use of "should" here as "my preference is". Let me know if that is wrong.

    Can you share your rationale of why this is your preference? Bear in mind that the community has already decided, through the appropriately painful :-P channels, that the way to do components in core is using SDC and not an alternative approach.

    Obligatory reminder here is that no module or theme can enable or disable SDC more that it can enable or disable Form API, the routing system, or the batch API. These are tools that are baked into core itself.

    But if Olivero is forcing us to use SDC, some of us will not be able to use Olivero as a base theme.

    I am also intrigued about this. What is the reason that will make it impossible for you not to use SDC? Is it personal preference, or is it something else I am missing?

    will we be able to remove some or all SDC components and replace those with regular Twig templates?

    In the end Twig will still be the render engine (if you choose to keep it), so you can override the templates that embed the components to include your twig templates. For that you'll need to copy the templates of the components being embedded, create the libraries manually, and then attach them. All of that can live in your theme, the one that extends from Olivero.

    Keep in mind that SDC, and the policy to use it in core, is not designed to ease the process of getting rid of it. If you feel strongly that it should, I encourage you to create an issue to that end that explains the reasons of why you think many people should want to remove SDC.

  • πŸ‡¨πŸ‡¦Canada xmacinfo Canada

    I see in our profiles that English is not the first language of either of us. I am interpreting the use of "should" here as "my preference is". Let me know if that is wrong.

    The way I use β€œshould” is to to indicate correctness, like in English. In French β€œshould” = β€œmust”, which misses some nuances between the two.

    In other words, we, the Drupal community, should let developers use SDC or plain Twig templates. Thankfully, we can already do that. πŸ˜€

    As a developer, and when chatting with other developers, we do not always want or need to use a components system; we create a bunch of templates and add CSS/JavaScript and that's it. However, most front-end devs (we can include themers) prefer using well define reusable components. That was, until now, hard to do in Drupal, and varied a lot between developers and themes teams. SDC helps standardizing components usage and their documentation and will push Drupal to new levels. I agree with that.

    The core community wants standards and good documentation. I agree with that.

    So the problem, which is not a problem, is, as a developer, do I create Twig templates as I did since Drupal 8 and use a few CSS files loaded through libraries, and be done with it, or I am forced to use the new SDC. This is not a problem as you told me. πŸ˜€

    When building a custom them, we (the dev team on that project) will be able to use either SDC or plain old Twig templates.

    Which leads to base themes. Can we use a base theme built on SDC (here I think about Olivero) and replace, let’s consider, component A and B and replace those with plain old Twig templates? If yes, then my problem is solved and I need not worry anymore.

    I like Olivero so much that I use it as a base theme.

  • πŸ‡³πŸ‡±Netherlands Martijn de Wit πŸ‡³πŸ‡± The Netherlands

    xmacinfo did you already try the new theme/template generator in Drupal ?

  • πŸ‡¨πŸ‡¦Canada xmacinfo Canada

    @Martijn de Wit

    Yes, I did. But that does not create a theme inheriting from a base theme.

  • First commit to issue fork.
Production build 0.71.5 2024