Compass 使用位于“config/compass.rb”中的配置文件告诉它重要目录在哪里。我认为它知道查看 config/compass.rb 因为它在预定义目录列表中搜索 compass.rb 配置文件
这是我用于 Rails 3 项目的配置文件
# This configuration file works with both the Compass command line tool and within Rails.
# Require any additional compass plugins here.
project_type = :rails
project_path = Compass::AppIntegration::Rails.root
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "public/stylesheets"
sass_dir = "app/stylesheets"
images_dir = "public/images"
environment = Compass::AppIntegration::Rails.env
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
preferred_syntax = :sass
我通过从 Rails 根目录运行以下命令来生成此文件:
compass init rails --css-dir=public/stylesheets --sass-dir=app/stylesheets --images-dir=public/images -x sass --using blueprint/basic
这是我用来运行 compass 的唯一命令,我在通过 rails 模板 https://github.com/sid137/rails-templates/blob/master/rails3.rb生成项目时运行它。我通过阅读指南针帮助并在线查找来构建此命令,因为我想自定义我的所有指南针设置。现在,我可以立即开始我的项目
compass watch .
或者
compass compile .