SASS --watch issue on windows 8.1

2019-02-24 23:49发布

问题:

I've got some issues with SASS. After updating the .scss file, the .css file won't update.

Lets say that this is my folder structure:

-scss
    -style.scss
-css
    -style.css

index.html

And I'm using this command from project root in cmd:

sass --watch scss/style.scss:css/style.css --style compressed

It compiles it the first time, but when I make some changes in the .scss file, it doesn't update.

I'm using:

win 8.1 64bit
ruby 2.0.0p481 64bit
Sass 3.4.2

How to make it watch for updates? Or am I doing something wrong?

Thanks

Update: Tested the same thing on ubuntu 14.04 and it works just fine (however, on ubuntu I've installed the latest version of ruby - ruby 2.1.2p95 )

Update 2: Issue on GitHub

回答1:

This was a bug in Sass 3.4.2: https://github.com/sass/sass/issues/1409

It was fixed in Sass 3.4.3: http://sass-lang.com/documentation/file.SASS_CHANGELOG.html#343_4_september_2014

If you're using Bundler, make sure your Sass version is not restricted to 3.4.2 in your Gemfile. Recommended line is gem 'sass', '~> 3.4.3'. The run bundle update within your project root.

If you're not using Bundler, simply run gem update sass.



回答2:

I also came across this issue. I downgraded Sass to version 3.3.14 and it worked for me again. No idea why.

Using: win 8.1 64bit ruby 2.0.0p481 64bit



回答3:

I had same problem and upon solution didn't helped. Looks like ruby on windows 8 has WDM (Windows Directory Monitor) problem and --watch command is not working properly.

I solved problem in this way:

  1. Downloaded and installed Installed Ruby 1.9.3p550 - Download link
  2. Downloaded and installed Development Kit (which is required to install WDM) for Ruby 1.9.3 - DevKit-tdm-32-4.5.2-20110712-1620-sfx.exe
  3. Extract DevKit to path C:\Ruby193\DevKit
  4. Run cd C:\Ruby193\DevKit
  5. Run ruby dk.rb init
  6. Run ruby dk.rb review
  7. Run ruby dk.rb install
  8. Then run gem install wdm

And after that, --watch command is working properly.

Hope this way will help someone.



标签: windows sass