Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sass doesn't watch changes in @import files [duplicate]

Tags:

import

sass

watch

I ran sass --watch styles.scss:styles.css in my css folder.

And it can watch the changes if I make edits to styles.scss

But in the styles.scss, I imported some other sass files from a different folder. And if I make changes in other files, it doesn't watch and translate those changes.

Anyone know a solution?

like image 529
user3338888 Avatar asked Dec 04 '14 21:12

user3338888


People also ask

Is @import deprecated in Sass?

As of October 2021 @import will be deprecated, along with global built-in functions, and one year after that (no later than October 2022) @import support will be dropped.

What is difference between @USE and @import in SCSS?

Fundamentally both rules do the same thing - load members inside another module. The main differences is how they handle members. @import makes everything globally accessible in the target file.

How do I watch changes in Sass?

Watching for changes in SASS Just add a --watch flag in the command to watch the changes made to the Sass file in src/styles directory. That's it. Now, the changes you make in the SASS file will automatically be compiled into CSS as soon as you save the SASS file!

What is the use of the @import function in Sass?

The SASS @import function helps us to import multiple SASS or CSS stylesheets together such that they can be used together. Importing a SASS file using the @import rule allows access to mixins, variables, and functions to the other file in which the other file is imported.


1 Answers

// main.scss
@import "./partials/_normalize";
@import "./partials/_article";

use a next command to watch both: a folder and a file

scss --watch ./partials/ ./main.scss

The underscore lets Sass know that the file is only a partial file and that it should not be generated into a CSS file http://sass-lang.com/guide

like image 99
Ivan Rave Avatar answered Nov 15 '22 10:11

Ivan Rave