Problem/Motivation
CivicTheme uses the Components module which uses Twig namespaces to support includes/embeds, e.g.
{% include '@atoms/button/button.twig' with {
SDC expects you to use "theme:component-name" (or "module:component-name"), e.g.
{% include 'civictheme:button' with {
Switching from Components to SDC namespaces means:
- UI Kit Twig files will diverge from Drupal implementation
- Non-Drupal Storybook will not run on components
Steps to reproduce
Proposed resolution
Note related issues:
#3444321: make SDC respect *.info.yml namespaces
#3390717: Allow declaration of template path in SDC
For now, this could be handled with build rules where all UI Kit includes/embeds Component namespaces are replaced with the SDC convention.
Then we'd need to ensure:
- Storybook uses the original UI Kit components (and custom ones)
- Drupal only finds the components tweaked for SDC
Remaining tasks
TBD
User interface changes
API changes
Data model changes
Comments
Comment #2
kristen polWaiting to hear back from @Wim Leers and @lauriii on if we need to yank the components modules and hardcode SDC namespaces for demo, so postponing for now.
Comment #5
kristen polWim would prefer not to have the dependency though Lauri says it's okay for the demo if we need it.
Comment #6
kristen polReopening for consideration.
Comment #7
kristen polMoving to postponed for now until we sort out the components working properly in XB.
Comment #8
kristen polGiven we are working through a lot of critical issues, I'm doubtful this will be worked on before Barcelona so leaving this as postponed and lowering priority given Lauri was okay with this being a dependency for Barcelona. We can remove afterwards if we don't get to it beforehand.
Comment #9
kristen polSomeone could work on this. Once this work is done though, we can't look at the components with Storybook, unless we do:
#3466372: Create SDDS build rules for merging SDC metadata files with UI Kit code
so that we take the UI Kit components and combine with SDC metadata YAMLs and README.md files such that these components are what are picked up by XB rather than how we've manually combined everything.
I'd say that this issue can be focused just on replacing the components module namespaces with the SDC namespaces so that we can test that once we are unblocked.
Comment #10
annmarysruthy commentedComment #11
kristen polThanks!
Comment #13
annmarysruthy commentedRaised MR for replacing the components module namespaces with the SDC namespaces. Kindly review MR !38
Comment #14
kristen polThanks! Assigning to Jacob for review.
Comment #15
kristen polI've merged in recent changes and fixes and did a quick test.
I switched to this MR branch and ran `npm run build` and get fatal errors for storybook (expected).
I get these when trying to use XB:
Comment #16
kristen polGiven this is a distraction from our current work which is much more pressing, I'm moving this back to postponed and this won't likely make it into the demo but can be worked on post-Barcelona. Thanks for trying to get it to work!
Comment #18
kristen polBumping to major but keeping postponing for more visibility in backlog.
Comment #19
kristen polLet's do this one first:
#3479191: Replace components module namespaces with fully-qualified paths
Comment #20
kristen polAssigning to Jacob for looking at this further.
Comment #21
kristen polIt would be good for us to understand what's the advantage of using:
rather than:
(which is being used in #3479191: Replace components module namespaces with fully-qualified paths)
other than it being more succinct. The latter works with non-SDC Drupal code.
Comment #22
jcandan commentedI am playing with this same problem space. I am building an organization-specific USWDS (like design.va.gov), with a concept similar to how Emulsify demo’d Western U with multiple in-house brands. The plan is to have Storybooks at those multiple levels, and then at the individual project instance level (Drupal and non-Drupal projects).
So, the Drupal-specific twig muddies the waters.
Still playing. Curious how this pans out.
Comment #23
kristen polGotcha. We will need create build rules that updates the components with the Drupal-y bits as we are starting with a non-Drupal-specific design system: https://github.com/civictheme/uikit
Comment #24
pdureau commentedI am not fond of
include 'civictheme:button':But it is better than
include '@civictheme/.../button.twig'(which share the same issues) because it helps us to stop thinking about templates (and its path) and let us focus on components as proper UI objects. The component template (Twig file) must be an implementation detail which must stay opaque. What is really meaningful is the component definition (YAML file).Comment #25
kristen polThanks so much 🙏 I’ll watch the video (it was on my list!)