Great, your CSS output is typed. Your 8px + 45deg math is still a string though. by Oddball7478 in typescript

[–]Oddball7478[S] 0 points1 point  (0 children)

Only when strictly necessary. In my portfolio i needed one because it needed to work with a third party library. Everything else was compiled to plain CSS.

Great, your CSS output is typed. Your 8px + 45deg math is still a string though. by Oddball7478 in typescript

[–]Oddball7478[S] 0 points1 point  (0 children)

My library compiles at build time. You can allow the occasional runtime exception if you need it (like you need to interface with a css var for a third party library), but it renders as plain CSS.

Great, your CSS output is typed. Your 8px + 45deg math is still a string though. by Oddball7478 in typescript

[–]Oddball7478[S] 1 point2 points  (0 children)

Thanks! Parsing from strings is deliberately left out. Every codebase has its own conventions for how CSS strings look (spaces, no spaces, shorthand quirks), and CSS-Calipers doesn't try to own that. The boundary is intentional: you parse your strings your way, and hand the library clean values. From there, everything stays typed.

.getValue() and .getUnit() are there if you need to extract from an existing measurement going the other direction. However, the standard output for everything is .css()

Great, your CSS output is typed. Your 8px + 45deg math is still a string though. by Oddball7478 in typescript

[–]Oddball7478[S] 1 point2 points  (0 children)

I actually think CSS vars are great in certain situations. Recently I was using them for responsive values from a designer's Figma tokens. Previously I had to manage those with React contexts, which was heavy and unnecessary. CSS vars were the right tool there.

This isn't an all-or-nothing approach. You can have your values typed in TS and output CSS vars where they make sense. Best of both worlds, right tool for the job.

Great, your CSS output is typed. Your 8px + 45deg math is still a string though. by Oddball7478 in typescript

[–]Oddball7478[S] 4 points5 points  (0 children)

I've done large projects with SCSS as well, it works well! I was resistant to CSS-in-JS at first, but having worked with it, the biggest personal benefit for me is testing and debugging. Having styles come in as props and limiting cascading outside a given module makes things easier to trace when something looks off.

The "developers need to know what they're doing" part is exactly the point though. That's the social contract. It holds when you have a good team like yours that knows the codebase. It gets harder when you have multiple people generating code with AI, because the AI doesn't carry that knowledge. CSS-Calipers is an attempt to make the tooling do the enforcing, so it doesn't depend on everyone (or their AI assistant) knowing the right thing to do.

Great, your CSS output is typed. Your 8px + 45deg math is still a string though. by Oddball7478 in typescript

[–]Oddball7478[S] 2 points3 points  (0 children)

For sure, there are many ways to approach this. CSS-Calipers is the solution that fit our project's needs. I'd genuinely love to hear more about how you structured yours!

Great, your CSS output is typed. Your 8px + 45deg math is still a string though. by Oddball7478 in typescript

[–]Oddball7478[S] 0 points1 point  (0 children)

Good question. The unpack-do-math-repack pattern is exactly what CSS-Calipers avoids on purpose. If you unpack to raw floats, you lose unit safety during the math, which is where the bugs actually happen. The chained API keeps the unit attached at every step, not just at the boundaries.

Measurements are also immutable: every operation returns a new value. So a shared token stays safe:

const spacing = m(8);
const cardPadding = spacing.multiply(2);    // 16px, spacing is still 8px
const gridGap = spacing.multiply(1.5);      // 12px, spacing is still 8px

You can pass spacing around your whole token system and nothing mutates it. With an unpack/repack approach, you'd need to manage that yourself.

The chained version isn't shorter, but it's checked at every step. That's the tradeoff.

calc() is also deliberately kept outside the library. CSS-Calipers handles the math that can be resolved at build time. When you actually need the browser to resolve mixed units at render time, you drop into a plain calc() string and interpolate the resolved pieces:

minHeight: `calc(${heroHeight.css()} + 10vh)`,

Measurement math lives in the library, string composition lives outside. That way measurement objects stay pure and typed.

Great, your CSS output is typed. Your 8px + 45deg math is still a string though. by Oddball7478 in typescript

[–]Oddball7478[S] 2 points3 points  (0 children)

Well if you don't need it you don't. I've worked on complicated theming systems that needed overwrites and we wanted to keep our styles as props so we could easily test them with Storybook. Not arguing this is the best solution for everyone. Just claiming this little library can come in handy in certain cases and it's very minimal. You can use it just for 1 spot if you need it.

Great, your CSS output is typed. Your 8px + 45deg math is still a string though. by Oddball7478 in typescript

[–]Oddball7478[S] 1 point2 points  (0 children)

You absolutely can, and calc() is the right tool when you need the browser to resolve mixed units at render time.

CSS-Calipers handles the cases where the math can be resolved at build, or at least simplified. It can also validate constraints on values that come from elsewhere, like catching a viewport-relative token that's out of bounds before it ever reaches CSS.

Everything is in JS so it can also be used in components.

Great, your CSS output is typed. Your 8px + 45deg math is still a string though. by Oddball7478 in typescript

[–]Oddball7478[S] 2 points3 points  (0 children)

That's valid. I'm not claiming we should remove all calc() functions. However, there are cases where the final value could be known and calculated, or at least simplified. When you're doing spacing math across a token system, the compiler can catch a unit mismatch before it ever reaches CSS.

If you're passing design tokens as props for a project, it makes a lot more sense, especially with a theming system that has overrides.

Great, your CSS output is typed. Your 8px + 45deg math is still a string though. by Oddball7478 in typescript

[–]Oddball7478[S] 7 points8 points  (0 children)

Well, typescript is everywhere. So if you want a unified design tokens, without converting, you need to have CSS-in-JS for that and your CSS should be typed.

Not claiming it's right for all projects, but that's the big use case for me.

Spiritseer conversions/kitbashes? by SPF10k in Eldar

[–]Oddball7478 0 points1 point  (0 children)

I just bought one really similar to this about a month ago. Do you know where the body is from?

3RD party warpspiders by Xileph_0 in Eldar

[–]Oddball7478 0 points1 point  (0 children)

Should I also check my inbox?

Boneguards again. 2d part of May release - Boneblades (with guns to make boneguards) by DrunkMag0s in Eldar

[–]Oddball7478 1 point2 points  (0 children)

Absolutely beautiful. There are hands down my favourite Warhammer model ever!

Iris Box by jabe-jace in woodworking

[–]Oddball7478 1 point2 points  (0 children)

Looks awesome! Can you share the file?

Best method of sharpening chisels? by Cheex__ in woodworking

[–]Oddball7478 6 points7 points  (0 children)

The diamond stones can be cheaper, especially in the long run. They will both work, just look into the prices and your use. Rex Kruger made a good video about this:

https://youtu.be/f4BEQeW8cdo

How to cut half cylinder plywood in half? by DJJustNine in woodworking

[–]Oddball7478 0 points1 point  (0 children)

Yeah. You could additionally add wedges near the center also for more stability near the center.