0

I am experiencing an issue while precompiling the assets of my Rails projects.

Here is the versions of some of the gems I am using:

rails (4.2.0)
bootstrap-sass (3.3.3)
sass-rails (5.0.1)

The project is an AngularJS project sourcing the following gems from Rails Asset:

rails-assets-bootstrap-additions (0.2.3)
rails-assets-angular-bootstrap (0.11.2)
rails-assets-bootstrap-sass-official (3.3.3)

Following the README on the bootstrap-sass Github page, I renamed my app/assets/stylesheets/application.css file to application.scss and replaced its content by:

@import "bootstrap-sprockets";
@import "bootstrap";

Here is the error I get when I launch RAILS_ENV=production rake assets:precompile --trace:

** Execute assets:precompile
rake aborted!
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 into ClothSword's answer to this similar post, but in my case puts config.assets.precompile.inspect outputs (lambda)>, /(?:\/|\\|\A)application\.(css|js)$/], which I believe to be the default.

Would anyone have more insight on this? You can browse the source here

Community
  • 1
  • 1
nimser
  • 620
  • 2
  • 9
  • 22
  • Unless you're modifying the contents of your Bootstrap gem, this looks like either a versioning problem (you'll likely need to switch to Sass 3.3 or older... *or* 3.4, depending on which one will make the error go away) or an error in Bootstrap itself. – cimmanon Mar 03 '15 at 13:17
  • what does your main scss file look like? – cport1 Mar 03 '15 at 14:11

1 Answers1

1

It looks like the problem I'm facing is that one of the gem I'm using, sprangular, is setting this precompile rule:

Rails.application.config.assets.precompile += %w( bootstrap/* )

If I comment out this rule and source my own modified version of the gem in the Gemfile, rake assets:precompile now works.

I'm not entirely sure the reason why they set a rule to precompile all of the boostrap files. Does that make sense?

I've created an issue in their Github repo to gain clarity on whether this is a bug or just me not configuring the asset pipeline properly in my app.

I will update this answer as I get clarity from the discussion over there. Feel free to make suggestions here too.

nimser
  • 620
  • 2
  • 9
  • 22