- Issue created by @pdureau
- 🇨🇭Switzerland 4aficiona2
Great if Drupal (finally) goes this way and has ambitous goals in being a "Design System first" CMS.
Maybe more "niche" stuff in the future (animations/transitions, (buildtime) design tokens...)
This is in my opinion an absolute must and basis to have a Design Token API if we want to call Drupal a "Design System first" CMS. Design Tokens fuel everything and are the most "atomic" design decisions — especially if they are also system/language/type agnostic.
There are quite good tools out there like https://styledictionary.com/ to also transpile/convert them to the wished format and having "CSS variables / custom properties / runtime tokens" availabe is absolute necessary.
Imo Design Tokens are a corner stone of a "Design System first" CMS :)
- 🇬🇧United Kingdom catch
Overall this looks great to me, there are thing that seem very obvious and others that aren't as clear, but I am not a design systems person so I'm really just looking at it for what the concrete changes for existing things would be.
I think it would be useful to try the theme/render -> SDC path for one (non-form) element so that we can hopefully flush out what the issues are with conversions, deprecation etc.
For me an example which you would think would be simple but unfortunately is not, is item_list. We already have multiple issues open trying to clean that up going back to at least 2008:
📌 Replace links.html.twig with item-list--links.html.twig Needs work
✨ Replace .info.yml with composer.json for extensions Postponed
📌 Remove title and wrapper div from item-list.html.twig Needs work
#2032695: Use item-list.html.twig instead of views_view_summary.html.twig →Non-exhaustive list of questions for me would be things like:
1. What does the new SDC for item lists look like?
2. What is the relationship between this and the replacement for #theme => links?
3. Can the duplicate views template just use the item_list SDC or does views need its own version for some reason?
4. What happens with existing uses of item_list that switch to the SDC but which are relying on theme suggestions.If we go through this for one element/theme function (including the duplicates and near duplicates and the usages) from start to finish, then it would hopefully make it easier to go through the process for all the other ones.
- 🇫🇷France pdureau Paris
Hi @4aficiona2
That's great to see another design system lover here 👍
This is in my opinion an absolute must and basis to have a Design Token API if we want to call Drupal a "Design System first" CMS. Design Tokens fuel everything and are the most "atomic" design decisions — especially if they are also system/language/type agnostic.
I agree (buildtime) Design Tokens have a central part in design system methodology. I called them "niche" in the issue description because the goal here is to make Drupal able to use an already built design system implementation.
"Working with a design system" as a different meaning according to the persona and the step:
- As a designer, I am designing the system, and I set variables in my design tools to organize my work. Some of those variables can be shared as design tokens.
- As a front-developer, I am implementing the design system, and I set variables in my CSS preprocessor (so, as Saas variables, Less Variables, Tailwind's @apply directives...). Those variables could also be considered as design tokens, retrieved from the ones shared by the designer. They are resolved at build.
- As a back-developer or site builder, I am using the design system, managing my Drupal displays using what was built by the front-developers from the (buildtime) design tokens:
- UI components
- Icon packs
- style utilities (in Tailwind, by design, each style option is also a design token but that's not the case in other design systems I have studied)
- CSS variables (which are an subset of the design tokens which are overridable at runtime)
- ...
The current issue is not for implementing a design system, but for using it. So, it is focused on the back-developer and site builder personas, to let them use the stuff built by the front-dev from design tokens, shipped i na Druapl theme, rendered by the browser. So, I don't see how the design tokens, which have already "disappeared" at this step, are fitting.
Visual workflow:
Anyway, I am not closing the door here. There may be something to do at the "using a design system" step, if I follow the hopes of some brilliant Drupalers:
- @e0ipso & @penyaskito have worked on a prototype: https://www.drupal.org/project/design_tokens →
- @d34dman is also doing some researches
- and you 😉
There are quite good tools out there like https://styledictionary.com/ to also transpile/convert them to the wished format and having "CSS variables / custom properties / runtime tokens" available is absolute necessary.
This tools looks great, it can be useful for the front-devs which want to expose some of the design tokens as CSS variables. It is a design system implementation decision.
To build our Drupal displays, why not using directly the CSS variables? So, we benefit from 2 strategic decisions made by the front-dev who:
- have already picked the tokens to expose at runtime, instead of struggling with myriad of obscure tokens
- set the default values according to the scopes ("scope" mechanism are not a thing with design tokens, it must be added at build time)