question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support vanilla-extract

See original GitHub issue

Is your feature request related to a problem?

Currently it seems that vanilla-extract is not supported in Qwik.

Reproduction:

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: Screen Shot 2022-10-21 at 12 04 14 PM

But when checking the <head> we see no stylesheet injected. Screen Shot 2022-10-21 at 12 04 48 PM

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:closed
  • Created a year ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
manucorporatcommented, Nov 28, 2022

Done!

npm run qwik add 
2reactions
wmertenscommented, Nov 1, 2022

@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

// Workaround until https://github.com/vanilla-extract-css/vanilla-extract/pull/895 is merged
process.env.VITE_RSC_BUILD = 'true';

in vite config before instantiating the VE plugin

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found