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.

Auto-compile imported scss files in style tags when they have changed

See original GitHub issue

Consider this code example

<style lang='scss'>
   @import '/src/css/variables.scss';

   $border-dark: rgba($base-color, 0.88);

   .alert {
     border: 1px solid $border-dark;
   }
</style>

Currently when I make changes to the variables.scss no components that import it update or reflect its changes. I have to save each component that imports it. Is there a way to get this working currently or is this a feature that needs building? Basically to recompile all affected files when imported .scss files are changed?

I’m currently using Svelte 3 and Parcel for my build along with a svelte.config.js file the contents of which look like this:

const sveltePreprocess = require('svelte-preprocess');
module.exports = {
  preprocess: sveltePreprocess()
};

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
vexkiddycommented, Feb 2, 2020

Ok… it works in the test repro I made for you, so the error I’m getting must be from another package I’m using in my main project! So all good! Amazing work! Thank you so much! 👍 💯

0reactions
rhernandogcommented, Feb 12, 2020

Ahh… sorry, I was a bit lost in the production file since it’s minified.

This is the log of result.stats after running npm run dev:

{
  "entry": "data",
  "start": 1581515108039,
  "includedFiles": [
    "D:/Web Apps/Svelte/webpack-sass-startup/template-webpack/src/app.scss"
  ],
  "end": 1581515108086,
  "duration": 47
}

After making a change in the scss file nothing happens in the CLI though.

Finally I’ve used node sass with Vue and React bundles using webpack dev server without any issues when the files are updated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changes to imported SCSS in style tag is not triggering a ...
Hey there, I feel like I'm missing something, but I have a pretty common use case where I'm importing a SCSS file into...
Read more >
Sass watch is detecting changes but not compiling to css
I am using Bourbon so all my .scss and .sass files are imported via mixins. ex. >>> Sass is watching for changes. Press...
Read more >
Sass: @import
As a convention, Sass files that are only meant to be imported, not compiled on their own, begin with _ (as in _code.scss...
Read more >
Documentation
Complete documentation for Svelte.
Read more >
How to Use Sass with CSS Modules in Next.js
CSS Modules are essentially CSS files that, when imported into ... I wanted to change only a <strong> element nested in a title,...
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