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.

SCSS/CSS not being generated

See original GitHub issue

❓Question

I’m facing a couple issues with SCSS while upgrading from v3 to v4, and I’m looking for some help! My project uses SCSS modules, loadable components, Tailwind, and Typescript plugins for Razzle. I use the simplified const style = require('./style.scss'); method of importing styles.

  1. The generated server html does not contain any style links, nor does the asset.json file have .css files shown. Specifically this means that assets.client.css is blank. (This is also the case with the with-scss project in the Razzle examples folder)
  2. HTML class names in both client and server apps are output as “undefined”. For example a container div element is output as <div class="undefined undefined">...</div>
  3. The <style> tags and all styles do render in the client app html, but they no longer have unique local identifier names like .style_home_containter__d38f3ls, they are just named .container

My razzle config is simple:

const SCSSPlugin = require('./packages/razzle/razzle-plugin-scss');
const LoadablePlugin = require('./packages/razzle/razzle-plugin-loadable');

module.exports = {
  plugins: [SCSSPlugin, LoadablePlugin, 'typescript'],
};

The custom scss plugin is a copy of Razzle’s scss package, with Tailwind prepended to the plugins array for postcss config.

LoadablePlugin is a copy of Razzle’s example config.

Any help is greatly appreciated.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
speedy250commented, Apr 5, 2021

I’ve found the source of undefined problem. I was using const style = require('./style.module.scss'); to import styles, as this was how I set the app up many moons ago. I switched those imports to import style from './style.module.scss' and voila! Typescript, Tailwind, SCSS, and loadable components all playing nicely together in Razzle.

0reactions
fivethreeocommented, Apr 3, 2021

Great if you figure it out 😀

Read more comments on GitHub >

github_iconTop Results From Across the Web

VIsual Studio Code - Live Sass Compiler Not Generating .css ...
I have tried setting the savePath to "/css" - After this - I tried saving my main.scss file, which is supposed to generate...
Read more >
css file not being generated · Issue #13 - GitHub
Everything seems to be working but a css file is not generated. Created a 'vscode' folder in the project root directory with a...
Read more >
Generated CSS files are not placed under SCSS, as before
Thus, seems CSS files are generated by some other tool, not SCSS File Watcher. To verify this, you can disable SCSS File Watcher,...
Read more >
How to Use Sass with CSS - freeCodeCamp
To do this, the compiler will generate a file with the CSS code. This transformation is called compilation.
Read more >
Sass Compiler NOT Working in Visual Studio Code - YouTube
In this tutorial I am going to explain how to fix the visual studio code live sass compiler extension if it is not...
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