I have a successful Rails 3.0.x project with the following subset of Gems in the Gemfile:
gem "compass"
gem "haml"
gem "haml-rails"
gem "html5-boilerplate"
I tried today to upgrade to Rails 3.1 and keep all functionality, and had numerous problems in doing so. I did not yet find a configuration that did work for me in production mode, so I am working now with developing mode.
I followed the following advices here:
production.rb
, development.rb
and application.rb
to update the configuration for the asset pipeline. But did not touch compass, sass, and html5-boilerplate.ie_html
is not available in production mode. The change in the Gemfile is noted downie_html
.group :assets
block was not successful. Most of the time, the dependency between e.g. compass and sass, or compass and html5-boilerplate could not be fulfilled.So my question is: Is there a working Gemfile which allows to use Haml, Sass, Compass, Html5-Boilerplate and of course Rails 3.1 together?
New Gemfile working in development mode, but not in production mode:
gem "haml-rails"
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
gem 'compass', '~> 0.12.alpha.0'
gem "html5-boilerplate"
end
gem 'jquery-rails'
I have tried to create a fresh Rails 3.1 application, and added there an image resource. There everything is working fine, so no difference between development mode and production mode. In my migrated application, I have now the following state:
First my apologies for adding another answer, but I think the history is helpful for others.
I tried again (thank's to the comment of @theanym) to create a new application with rails 3.1.1, html5-boilerplate, compass, sass and haml, and I found a working solution for development and production mode.
These are the steps I have taken:
When I started then in production mode, I got the following error:
c:\apps\ruby\rails3\not>rails s -e production
C:/apps/ruby/ruby192/lib/ruby/gems/1.9.1/gems/html5-boilerplate-1.0.0/lib/html5-boilerplate.rb:1:in `<top (required)>':
uninitialized constant Object::Compass (NameError)
from C:/apps/ruby/ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
I then changed the Gemfile
(only the relevant part):
group :assets do
gem 'sass-rails', '~> 3.1.4'
gem 'coffee-rails', '~> 3.1.1'
gem "compass", '~> 0.12.alpha.0', :group => :production
gem 'html5-boilerplate', :group => :production
gem 'uglifier', '>= 1.0.3'
end
The relevant part of the solution for me was to denote for compass
and html5-boilerplate
that additional argument :group => :production
.
I then had to precompile the assets, and had to change style.scss
to style.css.scss
, but that was a minor tweak. Tested the application both with development and production mode, and there seems to be no error.