1
votes

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.

1
There doesn't seem to be a question here. Have you tried anything? Did you get any errors?cimmanon
I have it all working now, just been playing with it since I posted. I basically want to know is, is compass doing all the sass compiling? I need confirmation on what is actually doing what. What parts is sprockets doing now with the asset pipeline. Also, how can I view the compiled css?rctneil
I can't help you beyond Sass/Compass (not a Ruby/Rails programmer). Compass is a wrapper around Sass that injects a lot of useful things (extensions, extra functions, a less verbose command, etc.). For those of us using Sass/Compass as a standalone, the compiled CSS file is placed in the directory listed in config.rb.cimmanon
I know how to use Compass, use it everyday outside of a Rails app. But it's just what bits are doing what inside of my personal Rails app where I am getting confused. I also, can't seem to find the compiled version of the final css when run from within the Rails app. I'm very confident in it's use outside of Rails though, it is a fantastic library! Thanks for your help. Maybe someone else will attempt help me out.rctneil
@rctneil rails doesn't compile your stylesheet & javascript assets in development mode that's why you can't find them. In development mode this is done on the fly by the sprockets-rails gem (please correct me if I'm wrong here). If you want to compile your assets you could run rake assets:precompileDaniel

1 Answers

0
votes

No. Compass isn't doing the Sass compiling.

Sass is an extension of CSS3 which adds nested rules, variables, mixins, selector inheritance, and more. Sass generates well formatted CSS and makes your stylesheets easier to organize and maintain.

All that compass does is adding additional features to Sass so you don't need to program them by yourself.


The line config.sass.preferred_syntax :sass tells Rails that your generated Sass files should have the Sass syntax (.css.sass) instead of the SCSS syntax (.css.scss).


Also no, you don't need to require susy if you added it to the Gemfile and made a bundle install. All you need to do is to import it in your application.css file after you have imported compass.

@import "compass"
@import "susy"