1

Starting a redesign of my site which is using Rails 3.2. I was already using Sass and Compass and for the redesign have thrown all the old styles out and want to add Susy into the mix. Just a few quick questions about how things work before I get going:

I have just added: config.compass.preferred_syntax :sass to my application.rb file in /config, is this correct? Is the application.rb file sort of substituting itself for the normal compass.rb config file on standard compass projects?

The line I added obviously changes the expected syntax to the sass indented one which I much prefer but it looks like that line is telling compass what syntax I like. Is compass now doing the compiling of the css and not sass? I also read in the sass docs that you can tell it what syntax you prefer, do I need to set them both? I'm just not sure what is doing what function!

I have also added gem "susy" into my Gemfile, do I need to add config.compass.require "susy" to /config/application.rb?

Also, If I want to set the fonts_dir, Compass docs state that by default for Rails apps it will default to public/fonts but I want to put them in /app/assets/fonts. Will that work?

From Compass docs:

String The directory where the font files are kept. Standalone projects will default to /fonts. Rails projects will default to "public/fonts".

I hope people will be able to shed some light on these issues for me.

4

1 回答 1

0

不,Compass 没有进行 Sass 编译。

Sass 是 CSS3 的扩展,它添加了嵌套规则、变量、混合、选择器继承等。Sass 生成格式良好的 CSS 并使您的样式表更易于组织和维护。

compass 所做的只是为 Sass 添加附加功能,因此您无需自己编写它们。


该行config.sass.preferred_syntax :sass告诉 Rails 您生成的 Sass 文件应该具有 Sass 语法 (.css.sass) 而不是 SCSS 语法 (.css.scss)。


同样不,如果您将 susy 添加到 Gemfile 并制作了bundle install. 您需要做的就是在您导入指南针后将其导入您的 application.css 文件中。

@import "compass"
@import "susy"
于 2013-06-05T16:48:42.147 回答