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

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

问题描述

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

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

  • 我已将 .sass 文件放在 public/stylesheets 中.这是放置它们的正确位置吗?
  • 当我运行 compass watch 时,它不会自动编译这些 .sass 文件.我必须手动指定文件:compass watch public/stylesheets/myfile.sass 等等.我如何让它自动工作?
  • 文件ie.cssprint.cssscreen.css 已放置在stylesheets/compiled 中>.如何在编译后不重新出现它们的情况下删除它们?
  • 我自己编译的.sass文件被编译成compiled/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/
  • 中删除它们
  • 做第一个回答,他们将被放入compiled/

推荐答案

Compass 使用位于config/compass.rb"中的配置文件,该文件告诉它重要目录的位置.我认为它知道查看 config/compass.rb,因为它会搜索 compass.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天全站免登陆