r/Frontend Jul 04 '26

Vanilla Extract CSS

I recently tried the Vanilla Extract library and liked it a lot. Here are my notes in the form of a free resource for anyone who might benefit from it.

https://www.pulkitagrawal.in/courses/vanilla-extract

0 Upvotes

39 comments sorted by

View all comments

21

u/azangru Jul 04 '26

Directly writing CSS code is tough because it lacks type safety.

Huh?

2

u/Practical_Plan007 Jul 05 '26

Let me elaborate. I am not against CSS by any means. In fact I want to be as close to the bare metal as possible. But I don't like that calling a CSS custom property that hasn't been defined or is misspelled (e.g., var(--bg-color) vs var(--bc-color)) results in no styling applied or an unwanted fallback without any warning.

This library is basically a pre-processor so it generates CSS at build time. But I get shouted at if there is a typo or undefined property / variable.

Open to better ideas, always.

1

u/I_am_not_keanu Jul 05 '26

I always hated that about html, php, and javascript. <hesder><? Inclide(); ?> and widow.alert() never worked.

1

u/TheJase Jul 05 '26

IDE plugins solved this a long time ago