简体   繁体   中英

Stuck while precompiling assets in Rails 3.2

I'm trying to put my first app into production and ran into the following when trying to precompile:

rake aborted!
Undefined variable: "$yellowCorp"
  (in app/assets/stylesheets/_dialog.scss)

$yellowCorp is declared in

  app/assets/stylesheets/_variables.css.scss

I've done quite a bit of reading and there seems to be quite a few people that have struggled with this. I've tried many solutions that have worked from them, but none work for me. In config/environments/production.rb I've tried

config.assets.precompile += %w(*.css.scss *.scss)

and

config.assets.precompile << [ "*.scss", "*.css", "*.js" ]

and

config.assets.precompile += [ "_variables.css.scss", "_dialog.scss" ]

...among others, but nothing changes, but nothing have gotten me past this point. Any help/advice would be greatly appreciated.

Thanks!

I imagine this problem stems from the order in which the files are compiled. It is compiling the dialog file before the variables.

What does your application.css.scss file look like?

Instead of requiring tree, you may have to specify the order in which to compile them:

@import "variables.css.scss"
@import "dialog.scss"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM