使用ruby在rails上安装Susy和Compass

使用ruby在rails上安装Susy和Compass

问题描述:

我刚开始在轨道上使用ruby,我试图做的第一件事情是安装gems指南针和susy。在弄清楚我需要将它们包含在gemfile中(我正在使用RubyMine并认为它会为我执行)之后,当我尝试将susy导入时仍然出现找不到,susy错误我的一个css.scss文件。

I'm just starting with ruby on rails and one of the first things I tried to do was install the gems compass and susy. After figuring out that I needed to include them in the gemfile (I'm using RubyMine and thought it would do it for me), I still got a missing "Could not find", "susy" error when I tried to import susy into one of my css.scss files.

我有Ruby版本1.9.3(194)

I have ruby version 1.9.3 (194)

和ruby宝石版本1.8.23

and ruby gems version 1.8.23

在我的捆绑包中需要哪些宝石(和版本)以及如何确保它们进入项目捆绑包的任何帮助,我都非常感激。

Any help on which gems (and versions) I need in my bundle, how to make sure they get in the project bundle, is greatly appreciated.

##### Gemfile:
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'compass-rails'
  gem 'susy', git: "git://github.com/ericam/susy.git"
  gem 'uglifier', '>= 1.0.3'
end

然后我有几个不同的css文件。
application.css.scss,screen.css.scss和_base.scss.css。

Then I have several different css files. application.css.scss, screen.css.scss and _base.scss.css.

application.css.scss

#### application.css.scss:
@import "screen";
# Here you import your normal .scss files as well, like:
# @import "products";

screen.css.scss

#### screen.css.scss
// ---------------------------------------------------------------------------
// Imports
@import "compass";
@import "base";

/* -------------------------------------------------------------------------*/
/* Layout */
// Here you can add layout styling or whatever... :)

_base.css.scss

// ---------------------------------------------------------------------------
// Imports

@import "susy";

// ---------------------------------------------------------------------------
// Basic Grid

$total-columns  : 12;
$column-width   : 4em;
$gutter-width   : 1em;
$grid-padding   : $gutter-width;

$show-grid-backgrounds  : true;

就是这样。现在,您可以在导入到application.css.scss的所有scss文件中使用Susy。

And that's it. Now you can use Susy in all your scss files that you import in application.css.scss.

我希望它能帮助您开始使用。

I hope it helps you to get started.