本文介绍了sass 可以转换为 css,但不能使用 watch 命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家,我是SASS初学者,刚开始学习Sass.所以,这个问题在某些人看来可能很荒谬.
everyone, I am SASS beginner, just started to learn Sass. So, this question may seemed ridiculous to someones.
这里,我有 style.scss
Here, I got 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文件:
I can get a css file:
h1 {
color: #009a82;
margin: 0;
padding: 0; }
#container {
width: 460px;
margin: 0px auto; }
但是,当我使用命令时
sass --watch Sass:style
我得到了:
/*
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'"; }
谁能告诉我为什么?我是否以错误的方式使用了watch"命令?
Anyone can tell me why?Do I use the "watch" command in a wrong way?
非常感谢.
推荐答案
尝试使用 sass --watch style.scss:style.css
这篇关于sass 可以转换为 css,但不能使用 watch 命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!