sass可以转换为css,但不能使用watch命令

时间:2014-12-09 06:13:28

标签: sass

大家,我是SASS的初学者,刚开始学习Sass。所以,这个问题对某些人来说可能看起来很荒谬。

在这里,我得到了style.scss

$myColor: #009a82;
$myString: " some text here ";
$myFontSize: 13px;
$myMargin: 0px auto;
$myWidth: 460px;

h1 {
    color: $myColor;
    margin: 0;
    padding: 0;
}

#container {
    width: $myWidth;
    margin: $myMargin;
}

当我使用命令

  

sass style.scss style.css

我可以获得一个css文件:

h1 {
  color: #009a82;
  margin: 0;
  padding: 0; }

#container {
  width: 460px;
  margin: 0px auto; }

但是,当我使用命令

  

萨斯 - 守萨斯:风格

我得到了:

/*
Error: Invalid property: "Backtrace:" (no value).
        on line 4 of Sass

1: /*
2: Errno::ENOENT: No such file or directory @ rb_sysopen - Sass
3: 
4: Backtrace:
5: C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/plugin/compiler.rb:482:in `read'
6: C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/plugin/compiler.rb:482:in `update_stylesheet'
7: C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/plugin/compiler.rb:215:in `block in update_stylesheets'
8: C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/plugin/compiler.rb:209:in `each'
9: C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/plugin/compiler.rb:209:in `update_stylesheets'

Backtrace:
Sass:4
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/engine.rb:719:in `parse_property'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/engine.rb:681:in `parse_property_or_rule'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/engine.rb:647:in `parse_line'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/engine.rb:525:in `build_tree'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/engine.rb:544:in `block in append_children'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/engine.rb:543:in `each'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/engine.rb:543:in `append_children'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/engine.rb:396:in `_to_tree'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/engine.rb:368:in `_render_with_sourcemap'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/engine.rb:285:in `render_with_sourcemap'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/plugin/compiler.rb:490:in `update_stylesheet'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/plugin/compiler.rb:215:in `block in update_stylesheets'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/plugin/compiler.rb:209:in `each'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/plugin/compiler.rb:209:in `update_stylesheets'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/plugin/compiler.rb:293:in `watch'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/plugin.rb:108:in `method_missing'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/exec/sass_scss.rb:370:in `watch_or_update'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/exec/sass_scss.rb:50:in `process_result'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/exec/base.rb:52:in `parse'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/exec/base.rb:19:in `parse!'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/bin/sass:13:in `<top (required)>'
C:/Ruby21/bin/sass:23:in `load'
C:/Ruby21/bin/sass:23:in `<main>'
*/
body:before {
  white-space: pre;
  font-family: monospace;
  content: "Error: Invalid property: \"Backtrace:\" (no value).\A         on line 4 of Sass\A \A 1: /*\A 2: Errno::ENOENT: No such file or directory @ rb_sysopen - Sass\A 3: \A 4: Backtrace:\A 5: C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/plugin/compiler.rb:482:in `read'\A 6: C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/plugin/compiler.rb:482:in `update_stylesheet'\A 7: C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/plugin/compiler.rb:215:in `block in update_stylesheets'\A 8: C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/plugin/compiler.rb:209:in `each'\A 9: C:/Ruby21/lib/ruby/gems/2.1.0/gems/sass-3.4.9/lib/sass/plugin/compiler.rb:209:in `update_stylesheets'"; }

任何人都可以告诉我为什么? 我是否使用&#34; watch&#34;以错误的方式命令?

非常感谢。

1 个答案:

答案 0 :(得分:8)

尝试使用sass --watch style.scss:style.css