deven-org / boiler

A fully customisable and tokenised design system boilerplate built by Accenture Song
https://boilerds.com/
MIT License
18 stars 7 forks source link

Research SASS as a CSS solution #1099

Open thrbnhrtmnn opened 6 months ago

thrbnhrtmnn commented 6 months ago

Description / User story

We want to invest some more time too investigate if SASS is a potential CSS library to use, as recommended by https://github.com/deven-org/boiler/issues/1081 .

The following key factors need to be considered:

Requirements / Prerequisites

Acceptance Criteria

Additional information

Current findings as researched via https://github.com/deven-org/boiler/issues/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

thrbnhrtmnn commented 5 months ago

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.