短评 · ·

X 归档 2022-07-10

2 条动态 · 图 1 · 视频 1
Quick CSS tip.🙈

If you use `clamp` with `calc` for things like fluid typography, you can drop the `calc`.

It's baked in! 💪

1️⃣ font-size: clamp(1rem, calc(5vw + 1rem), 5rem);
2️⃣ font-size: clamp(1rem, 5vw + 1rem, 5rem);

Video alt: Example showing that you can drop `calc`.
CSS 快速小贴士。🙈

如果你在流式排版这类场景中把 `clamp` 和 `calc` 搭配使用,其实可以把 `calc` 省掉。

它是内置的!💪

1️⃣ font-size: clamp(1rem, calc(5vw + 1rem), 5rem);
2️⃣ font-size: clamp(1rem, 5vw + 1rem, 5rem);

视频描述:演示可以省掉 `calc` 的例子。
One of my favorite quick refactoring techniques is to keep the old function/method around and assert ✅ that the outputs are the same in development.

This lets you validate refactors before writing tests.

I use this with the Strangler Fig pattern: https://docs.microsoft.com/en-us/azure/architecture/patterns/strangler-fig
我最喜欢的快速重构技巧之一:把旧的函数/方法保留在旁边,并在开发环境中断言 ✅ 两者的输出一致。

这让你在写测试之前就能验证重构。

我会把它与绞杀者模式(Strangler Fig pattern)搭配使用:https://docs.microsoft.com/en-us/azure/architecture/patterns/strangler-fig
@DavidKPiano 的配图 1/1