Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codehz/css-in-bun
CSS-in-Bun macro inspired by Meta's stylex (and johanholmerin/style9)
https://github.com/codehz/css-in-bun
bun bun-macro css-in-js typescript
Last synced: 3 months ago
JSON representation
CSS-in-Bun macro inspired by Meta's stylex (and johanholmerin/style9)
- Host: GitHub
- URL: https://github.com/codehz/css-in-bun
- Owner: codehz
- License: mit
- Created: 2023-10-31T10:18:32.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-05T13:30:10.000Z (6 months ago)
- Last Synced: 2024-09-29T05:21:36.130Z (4 months ago)
- Topics: bun, bun-macro, css-in-js, typescript
- Language: TypeScript
- Homepage:
- Size: 42 KB
- Stars: 13
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CSS-in-Bun macro inspired by Meta's stylex (and johanholmerin/style9)
Usage:
```tsx
// build.ts
import { Collector } from "css-in-bun/build";using collector = Collector();
const res = await Bun.build({
entrypoints: ["./src/index.ts"],
outdir: "dist",
});await Bun.write("./dist/style.css", collector.collect());
// component.tsx
import { create } from "css-in-bun" assert { type: "macro" };
const styles = create({
test: {
color: "red",
backgroundColor: "green",
"@media (min-width: 80em)": {
color: "purple",
":hover": {
color: "black",
},
},
":hover": {
color: "yellow",
},
},
});const Test = () =>
```Due to bun's bug(https://github.com/oven-sh/bun/issues/6014), use keyframes may cause bun crash.