我有一个成功运行过的Rails 3应用程序compass init rails ./ --using blueprint
。我可以@import
从/ stylesheets目录中归档文件,但是尝试时出现错误@import compass
。
现在,该应用程序具有两个简单的sass文件:
common.scss
$body-background: blue;
main.scss
@import "common";
//@import "compass";
body {
background: $body-background;
}
@import "compass"
注释掉该行后,此方法有效-我得到了蓝色背景,所以我知道Sass在起作用。
如果我取消注释该行,并尝试导入compass
或blueprint
其他任何内容,则会收到这样的错误。
Syntax error: File to import not found or unreadable: compass.
Load paths:
/Users/eric/path/to/myrailsapp/app/stylesheets
on line 2 of /Users/eric/path/to/myrailsapp/app/stylesheets/main.scss
1: @import "common";
2: @import "compass";
3:
4: body {
5: background: $body-background;
6: }
我可能不得不明确地告诉Sass在哪里可以找到Compass gem,所以我add_import_path
在config / compass.rb中添加了一行:
require 'compass'
require 'html5-boilerplate'
project_type = :rails
project_path = RAILS_ROOT if defined?(RAILS_ROOT)
add_import_path "/Library/Ruby/Gems/1.8/gems/" # unfortunately this has no effect
http_path = "/"
css_dir = "public/stylesheets"
sass_dir = "app/stylesheets"
images_dir = "public/images"
javascripts_dir = "public/javascripts"
cache_dir = "tmp/sass-cache"
http_images_path = "/images"
http_stylesheets_path = "/stylesheets"
http_javascripts_path = "/javascripts"
我已经搜寻了两天,无法确定为什么我的基本@import
陈述会出现这个问题。如何告诉Sass在哪里可以找到Compass和Blueprint库?
我这样修复此错误:
在application.rb我有
并更改为
这是将项目从3.0.3更新到3.2.13之后的结果