Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Carry Sass variables through the Assets Pipeline, Rails 3.1 rc1

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?

like image 487
zeeraw Avatar asked May 28 '11 15:05

zeeraw


1 Answers

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.

like image 200
Kolja Avatar answered Oct 10 '22 18:10

Kolja