Jan
Jan

Reputation: 16214

Heroku twitter bootstrap and sass compilation failed on production

I run a Rails 3.2 app

I wanna have "twitter-bootstrap" only available for the backend users.

in this specific backend layout I call the backend stylesheet:

  <%= stylesheet_link_tag "backends" %>

my asset structure look like this:

stylesheets
   application.css.scss
   backends.css.scss
   partials
      _colors.css.scss

application.css.scss

@import "compass/reset";
@import "compass/layout";
@import "compass/css3";
@import "compass/utilities";

// Font Settings

@import "partials/fonts";
@import "partials/colors";
@import "partials/pagination";

backends.css.scss

@import "bootstrap";
@import "partials/_colors.css.scss";

#fullscreen-green {
  background: $green;
  height: 100%;
  margin: 0;
}

My GEMFILE assets contains this:

group :assets do
  gem 'therubyracer', :platform => :ruby
  gem 'coffee-rails'
  gem 'sass-rails'
  gem "compass-rails"
  gem 'bootstrap-sass'
  gem 'uglifier'
end

All works perfectly in development on localhost. But when I push to heroku cedar stack and call the backend(production) the app crashes:

2013-04-07T17:56:26+00:00 app[web.1]: ActionView::Template::Error (File to import not found or unreadable: bootstrap.
2013-04-07T17:56:26+00:00 app[web.1]: Load path: /app
2013-04-07T17:56:26+00:00 app[web.1]:   (in /app/app/assets/stylesheets/backends.css.scss)):
2013-04-07T17:56:26+00:00 app[web.1]:     4:
2013-04-07T17:56:26+00:00 app[web.1]:     5: <head>
2013-04-07T17:56:26+00:00 app[web.1]:     6:   <title><%= content_for?(:title) ? yield(:title) : "title" %></title>
2013-04-07T17:56:26+00:00 app[web.1]:     7:   <%= stylesheet_link_tag "backends" %>
2013-04-07T17:56:26+00:00 app[web.1]:     8:   <%= stylesheet_link_tag "application" %>
2013-04-07T17:56:26+00:00 app[web.1]:     9:   <%= csrf_meta_tag %>
2013-04-07T17:56:26+00:00 app[web.1]:     10:   <%= javascript_include_tag "application" %>
2013-04-07T17:56:26+00:00 app[web.1]:   app/assets/stylesheets/backends.css.scss:2
2013-04-07T17:56:26+00:00 app[web.1]:   app/views/layouts/backend.html.erb:7:in `_app_views_layouts_backend_html_erb__3568065575647724370_33921820'
2013-04-07T17:56:26+00:00 app[web.1]:   app/controllers/dashboards_controller.rb:8:in `index'

config/production.rb

config.assets.compile = true
config.assets.compress = true
config.assets.precompile += Ckeditor.assets

Please keep in mind that I wanna have bootstrap ONLY in a SPECIFIC LAYOUT not application wide.

also did heroku run rake assets:precompile

Can someone help me out!? Trying to solve this *$/%&§ since the whole sunday

Thanks in advance!

Upvotes: 2

Views: 556

Answers (1)

Jan
Jan

Reputation: 16214

I have resolved the problem by putting three gems outside the assets block:

group :assets do
  gem 'therubyracer', :platform => :ruby
  gem 'coffee-rails'
  gem 'uglifier'
end

gem 'sass-rails'
gem "compass-rails"
gem 'bootstrap-sass'

Upvotes: 3

Related Questions