Support vanilla-extract
See original GitHub issueIs your feature request related to a problem?
Currently it seems that vanilla-extract is not supported in Qwik.
Reproduction:
- npm create qwik@latest
- npm save --save @vanilla-extract/css @vanilla-extract/vite-plugin
qwik v0.11.1
@vanilla-extract v1.9.1
@vanilla-extract/vite-plugin v3.6.1
Update the vanilleExtractPlugin to the vite.config.js
import { defineConfig } from "vite";
import { qwikVite } from "@builder.io/qwik/optimizer";
import { qwikCity } from "@builder.io/qwik-city/vite";
import tsconfigPaths from "vite-tsconfig-paths";
import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
export default defineConfig(() => {
return {
plugins: [vanillaExtractPlugin(), qwikCity(), qwikVite(), tsconfigPaths()],
};
});
Try importing a style:
// index.tsx
import { component$ } from "@builder.io/qwik";
import { container } from "./index.css";
export default component$(() => {
return <section class={`${container}`}>Hello</section>;
});
// index.css.ts
import { style } from "@vanilla-extract/css";
export const container = style({
padding: 10,
border: "5px solid green",
});
We can see the class to be generated correctly:
But when checking the <head>
we see no stylesheet injected.
Describe the solution you’d like
Make vanilla-extract work
First things first, would want to make vanilla-extract work.
Add integration
If the goal is to add more integration, we might just want to add an integration similar to tailwind integration.
Describe alternatives you’ve considered
No alternatives currently.
Additional context
Related twitter thread: https://twitter.com/itspatricku/status/1583516637810298881?s=46&t=-Y9jjtm0TKtKI0i817MIlw
Issue Analytics
- State:
- Created a year ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
vanilla-extract — Zero-runtime Stylesheets-in-TypeScript.
Write type‑safe, locally scoped classes, variables and themes, then generate static CSS files at build time. $. npm install @vanilla-extract/css.
Read more >8 substitutes for vanilla extract - Medical News Today
1. Vanilla paste. Vanilla paste — also called vanilla bean paste — is a mix of vanilla extract, vanilla beans, and sugar. ·...
Read more >5 Smart Ways to Use Pure Vanilla Extract (Besides Baking)
You're no stranger to vanilla extract. ... this might be the solution: The rich vanilla flavor will help meld the various fruits and ......
Read more >The 12 Best Vanilla Extracts of 2022 | by The Spruce Eats
Here, we break down the difference between the top vanilla extracts to help you choose the best for your needs. Our Top Picks....
Read more >6 Benefits of Vanilla Extract and Vanilla Beans - Healthline
1. Rich in vanillin · 2. May offer antioxidant effects · 3. May have anti-inflammatory properties · 4. May benefit brain health ·...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Done!
@Patrick-Ullrich This works: https://stackblitz.com/edit/qwik-starter-xk9ctw?file=vite.config.ts,src%2Fcomponents%2Fheader%2Fheader.tsx,vanilla-qwik-vite-plugin.ts,package.json,src%2Fcomponents%2Fheader%2Fheader.css.ts
All you need to do is
in vite config before instantiating the VE plugin