Alex Rivera | Logout

Carry Sass variables through the Assets Pipeline, Rails 3.1 rc1

Asked 2011-05-28T15:10:15.243
18

I recently branched one of my Rails 3.0 projects with the 3.1 rc1 to try the new assets pipeline. I've been using Sass in the project before going 3.1 so I've been setting up some variables and functions in a separate configure file and let all my other sass files import that one file at the first line.

This has been working out great to not repeat some color codes and general geometry through in the stylesheets. Problem is now with the new Assets Pipeline is that as I've understood it converts the ".css.sass" files to raw css before appending it to the rest of the code.

So if i specify, in my "application.css":

/*
 *= require ./configure
 *= require ./what_ever_other_files_i_want_to_import
*/

I get errors like:

Sass::SyntaxError
    Undefined variable: "$interactive".

When i try to access the file from: http://localhost:3000/assets/application.css

Any ideas?

Edit
Report

1 Answer

15

Sass supports Partials. That way you can include your separate configuration in __configuration.sass_ and reference it with

@import "configuration";

from your main sass-file.

answered 2011-05-28T15:38:18.663

Your Answer