Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

synthetic-to-native transform should handle SLDS utility classes #34

Open
nolanlawson opened this issue May 7, 2024 · 0 comments
Open

Comments

@nolanlawson
Copy link
Collaborator

One of the biggest blockers of moving from synthetic shadow to native shadow is HTML templates containing SLDS utility classes, e.g.:

<template>
  <h1 class="slds-text-heading_large">SLDS Example</h1>
  <div class="slds-p-top_medium">
    <p>Hello!</p>
  </div>
</template>

As part of synthetic-to-native, we could inject the minimal SLDS style rules into the component.css file, e.g.:

.slds-text-heading_large {
  font-size: 1.75rem;
  line-height: 1.25;
}

.slds-p-top_medium {
  padding-top: 1rem;
}

This would not work for all cases (namely selectors that cross shadow boundaries), but it could be a good ~95% solution with minimal perf impact (since it wouldn't include all of SLDS, just the minimal rules needed).

Another downside is that this would not keep pace with SLDS updates, but maybe this is okay since this is intended as a one-time operation. Perhaps another option here would be to transform from classes to styling hooks (i.e. CSS custom properties, which pierce native shadow roots).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant