tonyynot
tonyynot

Reputation: 221

Sass watch is detecting changes but not compiling to css

When I run sass --watch app.sass:app.css terminal shows that changes have been detected to sass but won't compile to css. I am using Bourbon so all my .scss and .sass files are imported via mixins.

ex.

 >>> Sass is watching for changes. Press Ctrl-C to stop.
 >>> Change detected to: css/2-modules/top-nav.scss

Upvotes: 8

Views: 14177

Answers (7)

Chicot
Chicot

Reputation: 59

I had the same problem, but it turns out I didn't include the '-w' at the end of my script, in order for the script to keep watching for changes and compile the sass file.

This is what I mean: "scripts": "compile:sass": "node-sass sass/main.scss css/style.css -w"

Upvotes: 0

JOY BOY
JOY BOY

Reputation: 1

  1. In your style folder create a file.scss with "_" in the beginning. For example: _fileName.scss

  2. Import it at the start of your principal scss file. For example:

    // in **mystyle.scss**   
    do : **@import "fileName"** (without the  underscore )
    
  3. Run your sass in the terminal. For example:

    sass mystyle.scss:mystyle.css --watch
    

Upvotes: 0

Sinju Angajan
Sinju Angajan

Reputation: 893

Create scss file by correct naming (make sure there is underscore "_")

_custom.scss

Import _custom.scss in main.scss (no underscore required)

// main.scss
      @import "custom";

Compile the code

sass --watch main.scss main.css

This will compile the code properly.

Upvotes: 0

philipdev
philipdev

Reputation: 33

I had the same issue! In my case, it was caused by having several @imports listed like this:

@import 'colors';
@import 'fonts';
@import 'size';

When i changed it to this it all started working again:

@import 'colors', 'fonts', 'size';

Although it should not be needed:
"Sass imports have the same syntax as CSS imports, except that they allow multiple imports to be separated by commas rather than requiring each one to have its own @import." - sass-lang.com/documentation

Upvotes: 2

user4973992
user4973992

Reputation:

Are you sure all of your partials are being imported into app.scss? I had the same issue, only to realize the partial file I was modifying (_custom.scss) wasn't actually being imported by the main.scss.

Upvotes: 0

iamlukem
iamlukem

Reputation: 71

Make sure the file you are saving with an _filename.scss has been properly imported into the mainfile.scss. if you have not imported the _filename.scss it will detect a change but not compile.

Upvotes: 7

Pranav Shah
Pranav Shah

Reputation: 99

check for the Config.rb file in your folder. without it you have to Ctr c every time and pass this command sass --watch scssname:cssname

then You can find your code in css.

Upvotes: 0

Related Questions