5

我已经完成compass create .并且compass init rails在我的项目目录中。几个问题:

  • 我已将.sass文件放在public/stylesheets. 这是放置它们的正确位置吗?
  • 当我运行时compass watch,它不会自动编译这些.sass文件。我必须手动指定文件:compass watch public/stylesheets/myfile.sass等等。我如何让它自动工作?
  • 文件ie.cssprint.cssscreen.css已放置在stylesheets/compiled. 如何在编译后不重新出现它们的情况下删除它们?
  • 我自己编译的.sass文件被编译为compiled/ts. 为什么他们在ts而不在compiled

提前谢谢了


编辑:解决了:

  • 不,把它们放进去app/stylesheets/
  • 如果您遵循上述操作,则可以使用
  • 将它们从app/stylesheets/
  • 做第一个答案,他们将被放入compiled/
4

1 回答 1

8

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 .
于 2011-03-31T11:33:53.650 回答