Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
856 views
in Technique[技术] by (71.8m points)

ruby on rails - bootstrap-sass: Undefined variable: "$baseLineHeight"

I've integrated bootstrap into my app using bootstrap-sass. The app works fine on my local machine, but when I go to deploy via capistrano, I get this error:

Undefined variable: "$baseLineHeight".
(in /var/www/CollegeSportsBlueBook/shared/bundle/ruby/1.9.1/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_accordion.scss)

When the capistrano attempts to run assets:precompile

I think this variable is throwing the error because it is the first variable in the first scss file that is attempted to be precompiled.

Something isn't loading up right. Any ideas what it might be?

Edit

Full trace here https://gist.github.com/2233071

Edit 2

Added application.rb and production.rb to gist

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You've edited your production.rb file so that Rails will attempt to precompile all CSS/JS files (line 48).

By default Rails will only precompile application.css(.scss). By adding the wildcard selector to config.assets.precompile you are asking Rails to precompile every css asset in your application, including Sass partials. Naturally, this is probably not the behaviour you wish for.

# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
config.assets.precompile += %w( *.css *.js )

Rails will therefore iterate over each css asset, compiling them. It so happens that _accordion.css.scss is the first Bootstrap asset it comes across, and Rails will attempt to compile that first. _accordion isn't independent, and requires some files to be loaded before it, hence the error. It should never be compiled as a separate file anyway.

You need to change your config.assets.precompile to add only the additional files that you need aside from application.css/application.js.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...