“指南针”如何工作/如何与导轨一起使用 [英] How does 'compass watch' work/how is it used with rails

查看:82
本文介绍了“指南针”如何工作/如何与导轨一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在项目目录中,我已经完成了 compass创建。 compass初始化轨道。几个问题:

I have done compass create . and compass init rails whilst in my project directory. A few questions:


  • 我已将我的 .sass 文件放在<$ c中$ c> public / stylesheets 。

  • 当我运行 compass手表时,它不会自动编译这些 .sass 文件。我必须手动指定文件: compass watch public / stylesheets / myfile.sass 等。如何使它自动工作?

  • 文件 ie.css print.css screen.css 已放置在 stylesheets / compiled 中。

  • 我自己编译的 .sass 文件如何编译为,如何在不删除它们的情况下删除它们?编译/ ts 。为什么它们在 ts 中而不在 compiled 中?

  • I have placed my .sass files in public/stylesheets. Is this the right place to put them?
  • When I run compass watch, it does not automatically compile these .sass files. I have to manually specify the files: compass watch public/stylesheets/myfile.sass etc. How do I get this working automatically?
  • The files ie.css, print.css and screen.css have been placed in stylesheets/compiled. How do I remove these without them reappeareing after compilation?
  • My own compiled .sass files are compiled to compiled/ts. Why are they in ts and not in compiled?

非常感谢

编辑:出来:


  • 不,将它们放在 app / stylesheets /

  • 如果您按照上面的说明进行操作

  • app / stylesheets /
  • $ b $中删除它们b
  • 首先回答,它们将放入 compiled /

  • No, put them in app/stylesheets/
  • Works if you follow above
  • Remove them from app/stylesheets/
  • Do first answer and they will be put in compiled/

推荐答案

指南针使用位于 config / compass.rb中的配置文件,该文件告诉它重要目录在哪里。我认为它知道可以在config / compass.rb中查找,因为它在预定义目录列表中搜索了一个指南针.rb配置文件

Compass uses a configuration file located in "config/compass.rb" which tells it where the important directories are. I think it knows to look in config/compass.rb because it searches a list of predefined directories for a compass.rb config file

这里是我使用的配置文件Rails 3项目

Heres the config file I use for my Rails 3 projects

# 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根目录运行以下命令来创建文件:

I generate this file by running the following command from the Rails root:

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 。我想通读指南针帮助并在线查看来构建此命令,因为我想自定义所有指南针设置。现在,我可以立即使用

This is the only command that I use to run compass, and I run it when generating my project through a rails template https://github.com/sid137/rails-templates/blob/master/rails3.rb . I constructed this command by reading through the compass help, and looking online, as I wanted to customize all of my compass setup. Now, I can immediately begin my projects with

compass watch .

compass compile .

这篇关于“指南针”如何工作/如何与导轨一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆