“指南针手表”如何运作?工作/如何与 Rails 一起使用

发布于 2024-10-28 05:46:44 字数 842 浏览 1 评论 0原文

我在项目目录中完成了 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/ 中删除code>
  • 做第一个回答,它们将被放入 compiled/

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

  • 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?

Many thanks in advance


Edit: Worked it out:

  • 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/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱你不解释 2024-11-04 05:46:44

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 运行以下命令来生成此文件root:

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 .

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

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

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

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 .

or

compass compile .
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文