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 for (S)CSS modules

See original GitHub issue

Qwik Version

0.0.39

Operating System (or Browser)

chrome 103 on windows 11

Node Version (if applicable)

node 18

Which component is affected?

Qwik Rollup / Vite plugin

Expected Behaviour

If I import a SCSS module like this:

import { component$, Host } from '@builder.io/qwik';

import classes from './greet.module.scss';

export const Greet = component$(() => {
  return (
    <Host>
      <div>Hello <span class={classes.pink}>pink</span>!</div>
    </Host>
  );
});

The class name should be applied to the DOM element AND the styles should be appended to the page (if sass is installed)

Actual Behaviour

The class name is applied to the DOM element but the styles are not in the page (even if I have sass installed). Regular non-module scss do work though (ie. import “./greet.scss”)

Additional Information

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
IgorSzymanskicommented, Oct 18, 2022

@TheKinng96 The thing you’re talking about is unrelated to the issue. The issue described here is related to CSS modules (namely, files named *.module.(s)css. Now the problem is CSS modules seem to only work with CSS files, but not SCSS files. Vite out of the box is supposed to handle the compilation from SCSS to CSS, but it seems the styles are processed, because classes created by CSS modules are added to HTML elements, but the stylesheet is missing, so the classes reference non-existing styles.

3reactions
jrson83commented, Oct 6, 2022

bump. any updates on this? only thing stopping me from using qwik for prod

Yeah, same here. SASS support would be a great addition.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation about css-modules - GitHub
A CSS Module is a CSS file in which all class names and animation names are scoped locally by default. All URLs (...
Read more >
Basic Features: Built-in CSS Support - Next.js
Next.js supports including CSS files as Global CSS or CSS Modules, using `styled-jsx` for CSS-in-JS, or any other CSS-in-JS solution! Learn more here....
Read more >
What are CSS Modules and why do we need them?
According to the repo, CSS modules are: CSS files in which all class names and animation names are scoped locally by default. So...
Read more >
Component-Scoped Styles with CSS Modules - Gatsby
CSS Modules let you write styles in CSS files but consume them as JavaScript objects for additional processing and safety.
Read more >
Support for CSS modules : WEB-17218 - YouTrack - JetBrains
With CSS modules (https://github.com/css-modules/css-modules), you can require CSS files from JavaScript (or similar combinations, e.g. loading SCSS in ...
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