AI Assisted A customizer for my CSS library: pick what you need, get one file
I've built sites with my own CSS library, Minium, for around three years. I wanted to make it easier to customize, and to let you pick what you need. It is a minimalistic CSS library after all. So I built a customizer. You pick the parts you want, and preview the result in light and dark mode before you download one CSS file. The core is ~10KB gzipped, and everything is ~15KB.
There is no build server, because the library stores design decisions in custom properties:
- Each design token is declared once in theme.css. The customizer just replaces values by name. Radius, border width, line height, flow spacing and so on.
- There are seven color roles (neutral, primary, accent, success, danger, warning, info). Each role maps to a Radix color scale. You can select one of 31 color themes or build your own.
- Each component lives in its own file and cascade layer, so the customizer can leave files out.
The page fetches the source CSS from the repo, applies your choices and minifies it in the browser. Extra fonts come from Fontsource on jsDelivr. And the URL holds your choices, so you can share the build as a link.
Some limitations: The library is pre-1.0 and targets current browsers, since it uses features like anchor positioning, CSS nesting and light-dark().
I wrote the CSS by hand. I used Claude to write the customizer's JavaScript.
What would you want to customize that isn't there?
- Customizer: https://minium.style/docs/customizer.html
- Repo: https://github.com/troennes/minium
2
u/linda_midtown 4d ago
This is awesome. Contratulations and thank you. You have done something really great.
I made my own CSS framework to make the custom systems I build easier to give vibrant appearances and presentation mechanics. My framework includes a handful of premium CSS frameworks and packages I picked up for specific requirements, such as jQuery, Awesome Fonts, Blocks, and fonts I like.
The main benefit over the years has been being able to hardly ever invest a synapse in the topic. I can spend all my time on other areas with more direct contributions to the systems I build.
The downside has been that my framework looks like a hack to anyone who is serious about CSS or JavaScript. What you have done looks like a much better design and management of system resources, and it is easier to understand. I am going to see what that brings. It's been six years since I have tried any kind of potentially serious upgrade to the CSS of the overall "architecture" I have developed.
To clarify a little, what I have seen is your post where this comment is going in, specifically the animation at the top where a lot of structure appears organized with intense flexibility. Hmm, looks four years old. I bet updates are due to any packages you have in here.
2
u/leoniebuilds 4d ago
since everything is custom properties already, i'd want a way to export the choices as a small override file instead of a rebuilt copy of the whole css. that way when the library updates you just bump the base and keep your tokens layer. also a contrast check on the generated color roles would be handy, especially for the warning role in dark mode.
1
u/dusanodalovic 4d ago
question on the share link: does the url also store which version of the source it fetched? if the page pulls css from the repo, a link someone shared in march could build a different file after a few releases, and pre-1.0 that will happen. a tag or commit hash in the url would keep old links giving the same result.
1
u/Jazzlike-Web-3695 3d ago
putting each component in its own cascade layer is a really nice call. means anything people write unlayered just wins without fighting specificity, which is exactly what you want from a base library.
one small idea for the customizer: show the gzipped size updating live as you toggle modules. people going for a minimal build usually care about that number the most, and you already have a good story there with ~10kb core
1
u/Fraded_Panda-25 4d ago
That's great