cristianbote / goober

🥜 goober, a less than 1KB 🎉 css-in-js alternative with a familiar API
https://goober.rocks
MIT License
3.14k stars 118 forks source link

Fix #491 #492

Open Looky1173 opened 2 years ago

Looky1173 commented 2 years ago

Fixes #491.

When compile() detects a falsy value, it replaces it with _; which will be ignored later by parse(). The semicolon is necessary to not confuse astish().

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
goober-rocks ✅ Ready (Inspect) Visit Preview Oct 9, 2022 at 10:31AM (UTC)
codesandbox-ci[bot] commented 2 years ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d5b51f30b516689e5b9911d22a876f2b556228d6:

Sandbox Source
Vanilla Configuration
Goober bug - falsy properties are not discarded Issue #491
Looky1173 commented 2 years ago
Hi @cristianbote, what do you think of this solution? It only adds a few bytes to the bundle size: Filename Size Change
dist/goober.esm.js 1.26 kB +11 B (0%)
dist/goober.modern.js 1.26 kB +11 B (0%)
dist/goober.umd.js 1.32 kB +10 B (0%)
Looky1173 commented 2 years ago

Hi @cristianbote, any updates on this PR? 🙂

cristianbote commented 2 years ago

Hey @Looky1173 I wanna take a deeper dive at this issue and figure out if we could avoid having to parse _; at all and rely on strict/shallow equality with falsy values.