“指南针观察”如何工作/如何与轨道一起使用

我做过compass create . 并在我的项目目录中compass init rails 。 几个问题:

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

提前谢谢了


编辑:解决了:

  • 不,把它们放在app/stylesheets/
  • 如果您按照上述方法工作
  • app/stylesheets/删除它们app/stylesheets/
  • 做第一个答案,他们将被compiled/

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 

这是我用来运行指南针的唯一命令,我在通过rails模板生成我的项目时运行它https://github.com/sid137/rails-templates/blob/master/rails3.rb 。 我通过阅读指南针帮助,并在线查看,构建此命令,因为我想自定义我的所有指南针设置。 现在,我可以立即开始我的项目

 compass watch . 

要么

 compass compile .