指南针手表在配置中产生语法错误.Rb编辑后



我在我的web服务器上使用Compass的SASS。编辑我的配置后。Rb文件和运行"指南针手表",它抛出以下错误。在编辑文件之前,它没有抛出错误。这里会出什么问题呢?这可能是我的编辑器保存文件的方式(结尾)?还是另有隐情?

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

很可能Coda正在改变文件的格式,我打赌是EOL(行结束)字符。我的配置。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

最新更新