[2.1.0] Copy variant templates when converting patterns to components

Created on 20 May 2025, 14 days ago

Problem/Motivation

When converting patterns to components using the @ui-patterns:migrate@ Drush command, we are notified of the existence of variant templates in our pattern with a message telling that variants doesn't exist in SDC so the template has not been migrated.

Steps to reproduce

  1. Create a pattern with variants
  2. Implement a variant template (ie. @pattern-ID--variant-VID.html.twig@)
  3. Run the migration command

Proposed resolution

Even if variant templates are not supported with SDC, that doesn't mean we cannot use variants to make variations on our markup. It's just a bit uglier because it relies on @if@ statements.
eg:

{% if variant == "my-variant" %}
markup here
{% elif variant == "my-other-variant" %}
other markup here
{% else %}
default markup here
{% endif %}

We can tune the command to output that kind of file.

Feature request
Status

Active

Version

2.0

Component

UI Patterns Legacy

Created by

🇫🇷France duaelfr Montpellier, France

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024