编译单个样式表时出现Compass错误:";单个样式表必须位于sass目录中;

编译单个样式表时出现Compass错误:";单个样式表必须位于sass目录中;,sass,compass-sass,compass,Sass,Compass Sass,Compass,使用Compass编译单个样式表时遇到问题。我可以使用compass compile执行所有文件,并使用compass watch监视更改。但是,当我尝试将特定文件分配给compass compile时,会出现以下错误: 单个样式表必须位于sass目录中 我的目录结构: project root - util -- compass --- config.rb - www -- css --- [destination for .css files] -- sass --- [.scss file

使用Compass编译单个样式表时遇到问题。我可以使用
compass compile
执行所有文件,并使用
compass watch
监视更改。但是,当我尝试将特定文件分配给compass compile时,会出现以下错误:

单个样式表必须位于sass目录中

我的目录结构:

project root
- util
-- compass
--- config.rb
- www
-- css
--- [destination for .css files]
-- sass
--- [.scss files]
My config.rb:

project_type = :stand_alone

# Set this to the root of your project when deployed:
project_path = "../../"
http_path = "www"               # The path to the project when running within the web server.
css_dir = "www/css"         # relative to project_path
sass_dir = "www/sass"       # relative to project_path
images_dir = "www/images"   # relative to project_path
javascripts_dir = "www/js"  # relative to project_path

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

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

# generate sourcemaps
sourcemap = true
/util/compass
文件夹运行时,以下各项工作正常:

compass compile
compass watch
这些方法不起作用:

compass compile builder.scss
compass compile ../../www/sass/builder.scss
compass compile www/sass/builder.scss
并导致错误,这可能意味着无法找到scss文件


我做错了什么?

这不是一个完美的解决方案,但至少能让你继续前进。这可能是由于compass中的某些错误导致无效的
sass\u路径
。因此,手动设置
sass_路径
,如下所示:

project_type = :stand_alone

# Set this to the root of your project when deployed:
project_path = "../../"
http_path = "www"               # The path to the project when running within the web server.
css_dir = "www/css"         # relative to project_path
sass_dir = "www/sass"       # relative to project_path
sass_path = File.expand_path(File.join(project_path, sass_dir))
images_dir = "www/images"   # relative to project_path
javascripts_dir = "www/js"  # relative to project_path

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

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

# generate sourcemaps
sourcemap = true
然后,您应该能够使用命令
compass compile../。/www/sass/builder.scss