lit / lit/lit.dev

Add documentation on css processing

Open
#349 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
142
Forks
230
PR merge metrics
No merged PRs in 30d

Description

Hello,

I think it would be useful to have some information on how to do css processing for lit libraries. A lot of projects seem to do something like this: https://github.com/microsoftgraph/microsoft-graph-toolkit/blob/main/gulpfile.js where they use gulp to process the styles through sass and or postcss and export a `CSSResultGroup` in Typescript or JavaScript that is then imported in the component's source code.

I think it would be beneficial to add something like this to the docs and maybe even the starter kits.

I believe that further optimization for target browsers would be an application level concern when bundling the application. However, if the CSSResultGroup is already embedded in JavaScript in the component library, further processing might be harder, the only way I found to make this work with postcss is https://dev.to/43081j/using-tailwind-at-build-time-with-web-components-1bhm.

Maybe sensible defaults can be given, so that further processing when bundling is unnecessary, but my point is it is not so trivial due to the nature of how Lit embeds styles and documentation would be nice.

Thanks,
Christian

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing documentation and starter kits to find where Lit library styling and build guidance belong. Compare the Gulp, Sass, PostCSS, and CSSResultGroup workflow described in the issue, then document a practical processing approach and clarify whether starter-kit changes are needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, sass, typescript
Domain
documentation, frontend
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.