Menu

Post image 1
Post image 2
1 / 2
0

Why UI Libraries Still Need Explicit CSS Imports

DEV Community·self-dev·25 days ago
#taeEHr2z
Reading 0:00
15s threshold

While building a UI library for SvelteKit, I wanted the consumer setup to feel as simple as possible: import { Button } from ' @svkit/ui ' ; Enter fullscreen mode Exit fullscreen mode No extra CSS imports. No Tailwind setup. No configuration. Just import the component and everything works. At first, this sounded straightforward. It wasn't. After several experiments, I ended up discovering something much deeper than a styling issue: CSS is not really part of the JavaScript module system. And modern bundlers only make it feel like it is. Context I'm currently building svkit (coming soon :)), a Svelte component library primarily built for my own projects and experiments around component architecture, styling systems, and developer experience. The library is split into two packages: @svkit/ui @svkit/styles Enter fullscreen mode Exit fullscreen mode @svkit/ui contains the Svelte components and logic. @svkit/styles contains the design tokens, themes, and component styles.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More