Compass watch在编辑后会在config.rb中生成语法错误

时间:2012-12-21 13:38:08

标签: sass compass-sass

我在网络服务器上使用SASS和Compass。编辑我的config.rb文件并运行“指南针监视”后,它会抛出以下错误。在编辑文件之前,它没有抛出错误。这可能会出错?它可能是我的编辑器(coda)保存文件的方式吗?或者还有其他事情发生了吗?

syntax error, unexpected tSTRING_BEG, expecting $end
@import "compass"

config.rb

# Require any additional compass plugins here.

# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"
@import "compass"

# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed

# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true

# To disable debugging comments that display the original location of your selectors. Uncomment:
# line_comments = false


# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass

1 个答案:

答案 0 :(得分:3)

很可能Coda正在改变文件的格式,我的赌注是EOL(行尾)字符。我的config.rb有UNIX换行符并且应该编译(Windows换行也行)。如果我将其更改为Mac换行符,我会收到此错误(这与您的错误非常接近):

$ compass watch
SyntaxError on line ["24"] of /usr/local/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass/configuration/serialization.rb: /path/to/config.rb:1: syntax error, unexpected tIDENTIFIER, expecting $end
# Require any addit...

我的编辑器(Notepad ++)说文件编码为ANSI。将其更改为我的编辑器支持的其他一些编码会产生如下错误:

$ compass watch
SyntaxError on line ["24"] of /usr/local/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass/configuration/serialization.rb: /path/to/config.rb:1: invalid multibyte char (US-ASCII)
Run with --trace to see the full backtrace
相关问题