短评 · ·

X 归档 2024-02-29

3 条动态 · 图 2 · 视频 1
📢 Parcel v2.12.0 brings support for macros, a new web-based REPL, improved CSS bundling, and manual code splitting!

Macros are JS/TS functions that run at build time instead of being bundled. They can generate constants, code, and even assets (eg css)!

https://parceljs.org/blog/v2-12-0/
📢 Parcel v2.12.0 带来了宏(macros)支持、全新的网页版 REPL、改进的 CSS 打包以及手动代码分割!

宏是在构建时运行而非被打包的 JS/TS 函数。它们可以生成常量、代码,甚至是资源(比如 css)!
@devongovett 的配图 1/1
Parcel also enables you to generate additional assets (eg css) from a macro. You can build your own statically extracted CSS-in-JS library in only a few lines of code. And since macros are just functions, you can create any API you want, eg accepting objects or theme values! 😲
Parcel 还支持从宏生成额外的资源(比如 css)。只需几行代码,你就能构建自己的静态提取式 CSS-in-JS 库。而且由于宏就是普通函数,你可以随心所欲地设计任何 API,比如接受对象或主题值!😲
@devongovett 的配图 1/1
@jh3yy07:12原推文
CSS Trick ✨

You can create this glitch hover effect by animating pseudoelement content 🎬

button:hover span:after {
animation: flip 0.2s calc(var(--i) * 0.05s);
}
@​keyframes flip {
20% { content: '_'; }
40% { content: var(--c1); }
60% { content: var(--c2); }
}

It's a funky…
CSS 技巧 ✨

通过给伪元素内容做动画,就能做出这种故障风 hover 效果 🎬

button:hover span:after {
animation: flip 0.2s calc(var(--i) * 0.05s);
}
@keyframes flip {
20% { content: '_'; }
40% { content: var(--c1); }
60% { content: var(--c2); }
}

这效果挺带感的……