Problem/Motivation
During the Drupal 8 life cycle, we have been unable to make improvements to Classy because of backwards compatibility concerns.
When talking with members of the frontend community, many people recognize themselves in a situation where they are using Classy, but they've ended up overriding most if not all templates.
Proposed resolution
Replace Classy with a new starter kit theme. The starter kit markup and CSS will be allowed to change over time since it acts only as a starting point for themes.
This comes with a downside of not being able to provide security fixes or bug fixes for themes built using this approach. We believe it isn't big of a change from the status quo since 1) most themes override a large number of templates and 2) this is already commonly used pattern in the contrib space. The theme could be generated by running ./core/scripts/drupal create-theme command.
Remaining tasks
Beta requirements
- #3253286: Remove unnecessary template overrides and associated code from starterkit theme
- #3206217: Allow starterkit themes to control how the theme is generated
- #3206226: Make updating changes from starterkit themes to generated themes easier
Stable requirements
- Identify and update existing handbook documentation that refers to Classy/Stable and related best practices
Write documentation on comparing versions of Starterkit themes
Post-stable requirements
- #3083275: [meta] Update tests that rely on Classy to not rely on it anymore
- #3308518: [Meta] Tasks to remove Classy theme from core and move to contrib
- Outline a documentation guide for moving from D9 to D10 themes
Nice to have
Done
- #2352949: Deprecate using Classy as the default theme for the 'testing' profile
- #3050389: [META] Remove dependency to Classy from core themes
- #3050384: Provide a starterkit theme in core
User interface changes
API changes
Data model changes
Release notes snippet
The starterkit theme generator has been in the works for a while. It became stable in Drupal 9.5.0 and will be replacing Classy in Drupal 10.0.0. Read blog post for more information about the starterkit theme generator.
Comments
Comment #2
lauriiiComment #3
lauriiiComment #4
davidhernandezWhat do we do with current Classy? do we move it to contrib? Does it need its name changed? If we remove it from core it seems the name could stay the same and avoid conflict.
Comment #5
catchSo the main issue is that if there's a security issue specific to the starterkit, we'd need to provide instructions on how to apply the fix to themes based on it in security announcements?
This seems like a reasonable trade-off to me, have we actually had any security issue specific to classy during the 8.x cycle at all? Usually it's lower level than the actual templates anyway.
Comment #6
lauriiiThis is the biggest downside of this change. At first it might seem like a big compromise, but in my opinion, it might not be as big of a problem as it might seem like since shipping security fixes in templates already run a risk of not ending up protecting production sites, and having security fixes changing templates is very rare.
I checked from Git history if there are any commits modifying Twig templates that would contain 'SA-' in the message, and I didn't find any. I agree that usually, it would be lower level than template, but in theory, it would be possible to have a security advisory that requires a change in a template.
Comment #7
lauriiiThe proposal is to move Classy to contrib so that it's not in Drupal 9. I don't think the name needs to be changed since it gets removed from core. This is different from #3050374: Create Drupal 9 stable theme since ideally, the contrib Drupal 8 Stable theme would use the core Drupal 9 as its base theme.
Comment #9
chi commentedClassy is a base theme for lots of custom and contrib themes. Moving it out of core will break those. Also Classy is widely used in core and contrib tests.
Can we first deprecate it,
make it hiddenand then remove in Drupal 10?Edit: Classy is already hidden in Drupal 8.
Comment #10
chi commentedOne more concern. Front-end developers tend to have own starter kits with SASS/PostCSS. As long as Classy is a "pure CSS" theme it cannot compete with their solutions.
Comment #11
batkorsubscribe
Comment #12
lauriiiI agree that we want to first deprecate Classy and then remove it in the following major release which would likely be Drupal 10. 👍
We've been taking steps to slowly make our infrastructure less dependent on Classy by making tests responsible for selecting their default testing theme #2352949: Deprecate using Classy as the default theme for the 'testing' profile. The next step is to make core tests not depend on Classy anymore.
Drupal core has a dependency on PostCSS already: #3060153: Use PostCSS in core, initially only for Claro. Theoretically, it would be possible to make the starterkit use this as well if that's what we want. I don't believe this would completely remove the need for contrib starterkits even though this would provide a much better experience to people who are using Classy at the moment.
Comment #13
chi commentedA quote from #3050384: Provide a starterkit theme in core.
Having all core templates in a custom theme would be a step back.
With the current approach it is quite easy to figure out what templates have been overridden in a custom theme because the theme only keeps templates that were changed.
What if instead of Starter Kit we generate a new base theme using Classy as a template? That theme should live inside
/themesnot in/core/themesso that it'll never be updated with Drupal core.I am wondering if the new Scaffold Composer plugin can help on this.
https://www.drupal.org/node/3041017
Comment #14
davidhernandezI don't understand how it would be a step back. The starterkit's intention is to remove the reliance on Classy as a base theme. It wouldn't be the only way to make a theme. If you don't want the collection of templates, you can still make a theme from scratch and inherit from core.
Comment #15
chi commented@davidhernandez Right now I have classes and markup that I need (thanks to Classy) without keeping the collection of all core templates in my theme. That will not be possible when we implement this proposal.
Comment #16
andypostMoreover it will bring more maintenance costs to custom themes to upgrade each template to new core's starterkit!
And more errors in upgrade if you forget to upgrade or copy new templates which is real "step back" in terms of dx/ux (which makes D harder to use for newcomers)
Comment #17
chi commented@andypost I think they don't have to upgrade unless some security issue in the starter kit happens.
Comment #18
xjmTargeting this against 9.1.x since it's a new feature. 🎉
Comment #19
davidhernandezYou don't need to upgrade anything from the starter kit. That is the point of it copying all the templates. So your theme can stay static from the time it was created, if you wish.
Comment #20
dwwIs this the appropriate top-level plan issue to add a dependency on #3083275: [meta] Update tests that rely on Classy to not rely on it anymore? We can't remove Classy from core while core's tests are still relying on classy-specific markup for assertions.
Comment #21
dwwAdding #3083275: [meta] Update tests that rely on Classy to not rely on it anymore as a child issue and remaining task before we can remove classy.
Comment #22
dww@bnjmnm opened #3110137: Remove Classy from core as a distinct step in this process, so I added that as a child of this, and am hereby adding it as a remaining task here.
Cheers,
-Derek
Comment #23
xjmComment #25
gábor hojtsy@laurii presented about this at DrupalCon Global:
Comment #27
andypostAdded as child #3206219: Allow configuring which theme is used as a starterkit theme
because contrib theme creators should be able to extend generator
Comment #28
andypostsorted active issues to top
Comment #30
lauriiiComment #31
xjmComment #32
xjmSorting the requirements into beta, stable, and post-stable steps, and adding a few items that were in our backlog but that don't have issues yet.
Comment #33
xjmComment #35
lauriiiComment #36
bnjmnmComment #37
lauriiiAdded draft release note and a draft CR.
Comment #38
spokjeComment #40
xjmI think we can probably mark this fixed now, and leave the remaining issues from the two metas to proceed on their own? (Since we moved the test technical debt from being tied to Classy to being tied to Starterkit itself.)
Comment #41
xjmDoing that, and crediting the folks who helped maintain the meta. Thanks everyone! 🎉