css - Rails Sass: variables arenot passed with @import -


i have rails project uses twitter bootstrap , sass. scss files structured folders have better overview. want define file global variables contains colors etc. , pass values down other files have less redundant code. while code imported , applied, variables don't work.

here current setup:

stylesheets/application.css.scss

@import "main";  /* stylesheets/ | |– base/ |   |– _typography.scss  # typography rules | |– components/ |   |– _buttons.scss     # buttons |   |– _messages.scss    # nachrichten |   |– _dropdown.scss    # dropdown | |– helpers/ |   |– _globals.scss     # sass variables |   |– _functions.scss   # sass functions |   |– _mixins.scss      # sass mixins |   |– _helpers.scss     # class & placeholders helpers  //more files omitted | |– vendors/ |   |– _bootstrap_and_overrides.css   # bootstrap |   |– _scaffolds.scss   # bootstrap  | | `– main.scss             # primary sass file */ 

im not using =require method not allow use variables , mixins (which id use).

i use main.scss contains imports. stylesheets/main.scss

@import "bootstrap-sprockets"; @import "bootstrap";  @import "helpers/globals"; @import "base/grid"; @import "base/typography";  @import "components/buttons"; @import "components/tables"; //other files omitted 

the helpers/globals.scss contains color definitions: stylesheets/helpers/globals.scss

$background-light : #4e4d4a; 

the file component/tables.scss supposed use variable.

.table-striped > tbody > tr:nth-child(2n+1) > {   tr, td, th {     background-color: $background-light;   } } 

according information on web , official sass-guide should work declared variable , import according file before file uses it. certainly, variable not found: undefined variable: "$background-light".

the whole procedure seems rather simple i'm running out of ideas. need set in environment files or need change application.css.scss? or might bootstrap interfere here?

thanks in advance help.

noting above, i've had experience assets not working expected. recommendation received use:

rake assets:clobber 

this clean pipeline.

https://github.com/rails/sprockets-rails/blob/master/readme.md


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -