bootstrap-rails
bootstrap-rails copied to clipboard
rake assets:precompile fails: Undefined variable: '@alert-padding'
Undefined variable: "$alert-padding".
(in /Users/pavlo/.rvm/gems/ruby-2.0.0-p195/gems/anjlab-bootstrap-rails-3.0.2.0/app/assets/stylesheets/twitter/bootstrap/_alerts.scss)
/Users/pavlo/.rvm/gems/ruby-2.0.0-p195/gems/anjlab-bootstrap-rails-3.0.2.0/app/assets/stylesheets/twitter/bootstrap/_alerts.scss:10
/Users/pavlo/.rvm/gems/ruby-2.0.0-p195/gems/sass-3.2.10/lib/sass/script/variable.rb:49:in _perform' /Users/pavlo/.rvm/gems/ruby-2.0.0-p195/gems/sass-3.2.10/lib/sass/script/node.rb:40:in
perform'
/Users/pavlo/.rvm/gems/ruby-2.0.0-p195/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:298:in visit_prop' /Users/pavlo/.rvm/gems/ruby-2.0.0-p195/gems/sass-3.2.10/lib/sass/tree/visitors/base.rb:37:in
visit'
/Users/pavlo/.rvm/gems/ruby-2.0.0-p195/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:100:in visit' /Users/pavlo/.rvm/gems/ruby-2.0.0-p195/gems/sass-3.2.10/lib/sass/tree/visitors/base.rb:53:in
block in visit_children'
/Users/pavlo/.rvm/gems/ruby-2.0.0-p195/gems/sass-3.2.10/lib/sass/tree/visitors/base.rb:53:in map' /Users/pavlo/.rvm/gems/ruby-2.0.0-p195/gems/sass-3.2.10/lib/sass/tree/visitors/base.rb:53:in
visit_children'
/Users/pavlo/.rvm/gems/ruby-2.0.0-p195/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:109:in block in visit_children' /Users/pavlo/.rvm/gems/ruby-2.0.0-p195/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:121:in
with_environment'
/Users/pavlo/.rvm/gems/ruby-2.0.0-p195/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:108:in visit_children' /Users/pavlo/.rvm/gems/ruby-2.0.0-p195/gems/sass-3.2.10/lib/sass/tree/visitors/base.rb:37:in
block in visit'
/Users/pavlo/.rvm/gems/ruby-2.0.0-p195/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:320:in visit_rule' /Users/pavlo/.rvm/gems/ruby-2.0.0-p195/gems/sass-3.2.10/lib/sass/tree/visitors/base.rb:37:in
visit'
/Users/pavlo/.rvm/gems/ruby-2.0.0-p195/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:100:in `visit'
I'm getting the exact same error when I run:
RAILS_ENV=production bundle exec rake assets:precompile --trace
Results in failure to successfully precompile before deploying to Heroku
@skellyc can you gist you gemfile?
I also got this problems.
This is my Gemfile
source 'http://rubygems.org'
gem 'rails', '3.2.14'
# gem 'thin'
# gem 'mysql2'
gem 'pg'
gem 'devise', '~> 3.0.3'
gem 'gon'
gem 'anjlab-bootstrap-rails', '>= 3.0.0.0', :require => 'bootstrap-rails'
gem 'filepicker-rails'
gem 'acts-as-taggable-on'
gem 'acts_as_commentable', '3.0.1'
gem 'acts_as_votable', '~> 0.7.1'
gem 'acts_as_follower', '~> 0.1.1'
# gem 'i18n-js'
gem 'strong_parameters'
gem 'will_paginate', '~> 3.0'
gem 'rolify'
gem 'cocoon'
gem 'friendly_id', '~> 4.0.10'
gem 'validate_url'
gem 'client_side_validations'
gem 'reform'
gem 'sidekiq'
gem 'settingslogic'
gem "active_model_serializers"
# gem 'unicorn'
gem 'sass-rails', '~> 3.2.3'
gem 'font-awesome-rails'
group :assets do
gem 'turbo-sprockets-rails3'
gem 'coffee-rails', '~> 3.2.1'
gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
gem 'angular-rails'
gem 'compass-rails'
gem 'chosen-rails'
gem 'bootstrap-datepicker-rails'
gem 'bootstrap-datetimepicker-rails'
gem 'angularjs-rails'
end
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem "geocoder"
group :development, :test do
gem 'bullet'
gem 'rspec-rails'
gem 'capybara'
gem 'database_cleaner'
gem 'launchy'
gem 'better_errors'
gem 'binding_of_caller'
gem 'xray-rails'
gem 'hirb'
gem 'hirb-unicode'
gem 'wirble'
gem 'annotate', '>=2.5.0'
gem "capistrano", "~> 2.15.5"
end
group :production, :staging do
# gem 'eventmachine'
# gem 'rainbows'
gem 'unicorn'
gem 'exceptional'
gem 'newrelic_rpm'
end
Hello, same error here, this is my gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
gem 'devise'
gem 'cancan', github: 'ryanb/cancan'
#gem 'mysql2', platform: :ruby
gem 'activerecord-jdbcmysql-adapter'
gem 'json_builder'
gem 'bootstrap-sass', github: 'thomas-mcdonald/bootstrap-sass'
gem 'ng-rails-csrf'
gem 'puma'
gem 'capistrano', group: :development
gem 'capistrano-rails', group: :development
gem 'capistrano-bundler', group: :development
gem 'capistrano-rvm', group: :development
gem 'capistrano-puma', require: false
gem 'sprockets-rails', :require => 'sprockets/railtie'
@astenuz this is not thomas-mcdonald/bootstrap-sass gem. This is anjlab-bootstrap-rails
Actually, tried with these Gemfiles - everything is ok.
Can some post application.css.scss?
@yury, you're right, however, it is the same error, could this be that the error is not generated by the bootstrap gem itself?. Actually i started having it when i had to add sprockets gem, before that it was precompiling correctly.
here is the stacktrace
rake aborted!
Undefined variable: "$alert-padding".
(in /var/www/feriasbiba/shared/bundle/jruby/1.9/bundler/gems/bootstrap-sass-efab96f854dc/vendor/assets/stylesheets/bootstrap/_alerts.scss:10)
/var/www/feriasbiba/shared/bundle/jruby/1.9/bundler/gems/bootstrap-sass-efab96f854dc/vendor/assets/stylesheets/bootstrap/_alerts.scss:10
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/script/variable.rb:49:in `_perform'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/script/node.rb:40:in `perform'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/perform.rb:298:in `visit_prop'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/base.rb:37:in `visit'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/perform.rb:100:in `visit'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/base.rb:53:in `visit_children'
org/jruby/RubyArray.java:2413:in `map'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/base.rb:53:in `visit_children'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/perform.rb:109:in `visit_children'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/perform.rb:121:in `with_environment'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/perform.rb:108:in `visit_children'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/base.rb:37:in `visit'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/perform.rb:320:in `visit_rule'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/base.rb:37:in `visit'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/perform.rb:100:in `visit'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/base.rb:53:in `visit_children'
org/jruby/RubyArray.java:2413:in `map'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/base.rb:53:in `visit_children'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/perform.rb:109:in `visit_children'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/perform.rb:121:in `with_environment'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/perform.rb:108:in `visit_children'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/base.rb:37:in `visit'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/perform.rb:128:in `visit_root'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/base.rb:37:in `visit'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/perform.rb:100:in `visit'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/visitors/perform.rb:7:in `visit'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/tree/root_node.rb:20:in `render'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/engine.rb:315:in `_render'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sass-3.2.12/lib/sass/engine.rb:262:in `render'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/sass_template.rb:53:in `evaluate'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/context.rb:197:in `evaluate'
org/jruby/RubyArray.java:1613:in `each'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/context.rb:194:in `evaluate'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/processed_asset.rb:12:in `initialize'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/base.rb:374:in `build_asset'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/base.rb:395:in `circular_call_protection'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/base.rb:373:in `build_asset'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/index.rb:94:in `build_asset'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/caching.rb:55:in `cache_asset'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/index.rb:93:in `build_asset'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/base.rb:287:in `find_asset'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/index.rb:60:in `find_asset'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/bundled_asset.rb:16:in `initialize'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/base.rb:377:in `build_asset'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/index.rb:94:in `build_asset'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/caching.rb:55:in `cache_asset'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/index.rb:93:in `build_asset'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/base.rb:287:in `find_asset'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/index.rb:60:in `find_asset'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:211:in `find_asset'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:257:in `benchmark'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:210:in `find_asset'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:119:in `compile'
org/jruby/RubyArray.java:1613:in `each'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:118:in `compile'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:60:in `define'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-2.10.0/lib/rake/sprocketstask.rb:146:in `with_logger'
/var/www/feriasbiba/shared/bundle/jruby/1.9/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:59:in `define'
org/jruby/RubyProc.java:271:in `call'
org/jruby/RubyArray.java:1613:in `each'
org/jruby/RubyArray.java:1613:in `each'
org/jruby/RubyKernel.java:1103:in `load'
Facing the same error.
@tomoyuki28jp application.css.scss?
@yury, thanks for your reply! I got the same erorr when I run rspec tests, so my error might be different one from this issue. (sorry!)
Here is my application.css.scss
/*
*= require_self
*= require_tree .
*/
@import "twitter/bootstrap";
I'm using bootstrap variables in other css files. ex: app/assets/stylesheets/posts/index.css.scss
@import "twitter/bootstrap/variables";
.user { font-size: $font-size-base; }
And I get errors like this one:
5) Posts GET /posts works! (now write some real specs)
Failure/Error: get posts_path
ActionView::Template::Error:
Undefined variable: "$font-size-base".
(in /Users/tomo/foo/app/assets/stylesheets/application.css.scss)
Here is my Gemfile abount anjlab-bootstrap-rails.
Gemfile
gem 'anjlab-bootstrap-rails',
require: 'bootstrap-rails',
github: 'anjlab/bootstrap-rails'
Gemfile.lock
GIT
remote: git://github.com/anjlab/bootstrap-rails.git
revision: 461121444e24cdf78357418bfca9f2b8a9a1c518
specs:
anjlab-bootstrap-rails (3.0.3.0)
railties (>= 3.0)
sass (>= 3.2)
is your gem on top most group in Gemfile? not in assets?
what if you remove //require_self and require_tree .
and put something like this:
@import "twitter/bootstrap";
@import "posts/index";
@yury Not in assets. My Gemfile starts like this:
source 'https://rubygems.org'
gem 'rails', '4.0.1'
gem 'mysql2'
gem 'therubyracer'
gem 'sass-rails', '~> 4.0.0'
gem 'anjlab-bootstrap-rails',
require: 'bootstrap-rails',
github: 'anjlab/bootstrap-rails'
@yury, I've tried this:
@import "twitter/bootstrap";
@import "posts/index";
But I get the same error like: Undefined variable: "$font-size-base".
@yury Ah, sorry. Removing "require_tree ." and import each CSS file actually works. Importing all the CSS files manually is not an ideal way, is there a better way to fix it?
require_tree is just recursively pulling in each individual scss file so the sass isn't getting properly complied. Just go to your main scss file (whatever you have the file named) and perform an @import to bootstrap. @tomoyuki28jp if you use the @import method I described you won't actually be doing anything "manually" sass with just pull everything in automatically. The only import you really need to do is the main bootstrap sass file.
@scottsword Thanks for your reply. I tried your way, but it doesn't work for me. If I use require_tree .
in application.css, it is executed before @import "bootstrap";
so I get the Undefined variable
error, I think.
Hi I'm also having the same issue. I've this issue while assets precompile, during deployment on my staging server, using capistrano script.
rake aborted!
DEBUG[df74fefa] Sass::SyntaxError: Undefined variable: "$alert-padding".
DEBUG[df74fefa] (in /home/deploy/apps/cbu_staging/shared/bundle/ruby/2.1.0/gems/bootstrap-sass-3.3.1.0/assets/stylesheets/bootstrap/_alerts.scss:10)
I'm using
Ruby : '2.1.3'
Rails : '4.1.5'
Here is my gist url :
https://gist.github.com/forever-ram/7f9c3a61f36033fc8a4f
In my gem file I've three Gems which are mostly using
gem 'devise'
gem 'activeadmin', github: 'activeadmin'
gem 'comfortable_mexican_sofa', '~> 1.12.0'
when I've applied the 'active_admin' gem and push to server I've got error in assets precompile so I've added this solution for fix the issue (I don't know what issue at that time)
config.assets.precompile += %w(*.svg *.eot *.woff *.ttf *.gif *.png *.ico)
config.assets.precompile << /\A(?!active_admin).*\.(js|css)\z/
Now I've added gem "'comfortable_mexican_sofa', '~> 1.12.0'" and I've this issue : Sass::SyntaxError: Undefined variable: "$alert-padding"
I've tried with the one solution by adding
config.assets.precompile += %w(*.js *.css *.svg *.eot *.woff *.ttf *.gif *.png *.ico)
but after this I've got another issue with active admin
rake aborted!
DEBUG[d30d2808] Sass::SyntaxError: Undefined mixin 'global-reset'.
DEBUG[d30d2808] (in /home/deploy/apps/cbu_staging/shared/bundle/ruby/2.1.0/bundler/gems/activeadmin-5af560b2b6cd/app/assets/stylesheets/active_admin/_base.css.scss:3)
DEBUG[d30d2808] /home/deploy/apps/cbu_staging/shared/bundle/ruby/2.1.0/bundler/gems/activeadmin-5af560b2b6cd/app/assets/stylesheets/active_admin/_base.css.scss:3:in `global-reset'
DEBUG[d30d2808] /home/deploy/apps/cbu_staging/shared/bundle/ruby/2.1.0/bundler/gems/activeadmin-5af560b2b6cd/app/assets/stylesheets/active_admin/_base.css.scss:3
I don't have 'apllication.css.scss' file in my assets. Please let me know what is the exact solution for the main issue.
Facing a similar error here. Here is how it hungs:
Sass::SyntaxError: Undefined variable: "$alert-padding".
(in /home/owner/.rvm/gems/ruby-2.1.5/gems/bootstrap-sass-3.3.3/assets/stylesheets/bootstrap/_alerts.scss:10)
I looked up with bundle open
in the bootstrap-sass
gem and found out that the variable was defined in assets/stylesheets/bootstrap/_variables.scss
.
So I thought importing that file in app/assets/stylesheets/application.css.scss
should solve the problem. Here's how I do it:
@import "bootstrap/variables";
But still the same error appears. Following the advice of this post on SO, I've done a puts config.assets.precompile.inspect
in application.rb to check that wierd precompiling rules where not set anywhere, but it returns (lambda)>, /(?:\/|\\|\A)application\.(css|js)$/]
which I think might be the default?
Did anyone find a solution to this?
Hello EveryOne. Just add these lines in your config/application.rb if you are using scss instead of css.
config.assets.precompile << %w( *.scss *.js )