Using Stylify CSS in Qwik Framework

Qwik is reimagined JavaScript framework for the edge. No hydration, auto lazy-loading, edge-optimized.

Stylify can be used within the Qwik Framework using the Stylify CSS Vite plugin.

Try it on StackBlitz


Integration can be installed only via CLI like NPM or Yarn:

yarn add @stylify/unplugin
npm i @stylify/unplugin


Edit the vite.config.js.

import { defineConfig } from 'vite';
import { stylifyVite } from '@stylify/unplugin';

const stylifyPlugin = stylifyVite({
    bundles: [
        { files: ['src/**/*.tsx'], outputFile: 'src/global.css' }
    // Optional -
    compiler: {},

export default defineConfig({
    plugins: [stylifyPlugin]

Import global.css in src/root.tsx:

import './global.css';

Split bundles for each page

Bundles can be also configured for each page separately. With this approach, you can get the smallest css possible. For example:

bundles: [
    // Layout
    { files: ['src/root.tsx', 'src/routes/layout.tsx'], outputFile: 'src/assets/css/layout.css'},
    // Index page
    { files: ['src/routes/index.tsx'], outputFile: 'src/assets/css/index.css'},

In src/routes/index.tsx the following:

import { useStyles$ } from '';
import indexCss from '../assets/css/index.css';
// ...

export default component$(() => {
    // ...

And add the layout import import './assets/css/layout.css' in src/root.tsx.


There is a lot of options you can configure:

Where to go next?