Rockbot
Rockbot

Reputation: 973

How to pass Bootstrap-Variables in Rails

I try to pass Bootstrap Variables to other files in Rails - and fail.

My application.css.scss looks like this:

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require_self
 *= require_tree .
*/

/* Import own Vars */
@import 'myvars';

/* Import Twitter Bootstrap */
@import 'bootstrap';

/* Import own layout */
@import 'custom';

When I create a $testVar: 100px; in _myvars.scss and try to use it in custom.css.scss it´s not working - the page fails to load and I get an Undefined variable: "$testVar".-Error

It works when defining the variable directly in custom.css.scss but I´d rather have a overview-file with all my variables (like I used to have when using TB as a standalone). I´m very new to Rails, so please be patient :)

Thanks in advance!

Upvotes: 2

Views: 452

Answers (1)

Thanh
Thanh

Reputation: 8604

You have to remove *= require_tree . . Check this screen cast for more info.

Upvotes: 3

Related Questions