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

Research SASS as a CSS solution #1099

Open
3 of 8 tasks
thrbnhrtmnn opened this issue May 6, 2024 · 1 comment
Open
3 of 8 tasks

Research SASS as a CSS solution #1099

thrbnhrtmnn opened this issue May 6, 2024 · 1 comment
Labels
🚫 blocked This issue is blocked ⭕ core team issue This is for the core team and should not be done by contributors ⌨️ dev issue Task is for developers

Comments

@thrbnhrtmnn
Copy link
Contributor

Description / User story

We want to invest some more time too investigate if SASS is a potential CSS library to use, as recommended by #1081 .

The following key factors need to be considered:

  • Supports Server Side Rendering (SSR)
  • Supports code driven transformation of CSS (either at build-time or runtime)
  • Provides a satisfying developer experience which includes:
  • Syntax highlighting
  • Context aware editor auto-completion, code navigation and refactoring
  • CLI validation tools
  • Extensive documentation
  • Allow for targeted style overrides from outside the component
  • Allow for targeted style re-use from outside the component

Requirements / Prerequisites

Acceptance Criteria

  • SASS has been evaluated by the key factors we defined for a CSS solution
  • The outcome has been documented
  • We are able to decide on the CSS approach after further research of Vanilla Extract and SASS has been finished

Additional information

Current findings as researched via #1081

While css-in-js is a powerful tool it can come with a host of issues such as:

Unfamiliarity for people who are used to writing more traditional CSS
Bad tooling integration
Configuration overhead
Complexity
While the most popular libraries out there try to tackle these issues head on by sticking close to standard css syntax and by providing extra tooling - those tools are often plenty, might not play well with other tools or might be maintained by different people featuring various levels of quality.

So to minimise the amount of dependencies and tooling needed we could opt for a more traditional and proven css approach like using SASS in conjunction with build-time plugins like postcss-scss, babel-plugin-transform-postcss, webpack postcss-loader or webpack css-loader to inject those styles into our javascript.

This approach should theoretically be compatible with our current Lit style declaration but has a few potential shortcomings that we need to look at in more detail. Namely:

css-modules aren't natively supported in typescript. This means that we have to take extra care not to end up with unmanaged, loosely-coupled class name references. Our build script should ideally throw an error when we try to reference non-existing css class names.
typescript-plugin-vscoce for editor support
SASS might not be a powerful enough language to support our TokenIterator concept.
We have to implement a SASS output target for our figma-design-tokens package.
Overall i think that this approach is worthy of further investigation as it could lead to a much better dev experience.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@thrbnhrtmnn thrbnhrtmnn added ⌨️ dev issue Task is for developers 🚫 blocked This issue is blocked ⭕ core team issue This is for the core team and should not be done by contributors labels May 6, 2024
@thrbnhrtmnn thrbnhrtmnn added this to the CSS Improvements milestone May 6, 2024
@thrbnhrtmnn
Copy link
Contributor Author

Improving our current CSS approach with #922 and #1021 (and follow up tasks for all other components to remove class maps) seems to be the more safe next steps than to invest time in this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚫 blocked This issue is blocked ⭕ core team issue This is for the core team and should not be done by contributors ⌨️ dev issue Task is for developers
Projects
None yet
Development

No branches or pull requests

1 participant