我有一个成功运行的 Rails 3 应用程序compass init rails ./ --using blueprint
。我可以@import
从 /stylesheets 目录中创建文件,但是当我尝试@import compass
.
现在该应用程序有两个简单的 sass 文件:
common.scss
$body-background: blue;
主文件
@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 库?