Is there a valid Gemfile for Rails 3.1 along with Scss, Haml, Compass and HTML-Boilerplate in production mode?

I have a successful Rails 3.0.x project with the following subset of Gems in a Gemfile:

gem "compass" gem "haml" gem "haml-rails" gem "html5-boilerplate" 

I tried today to upgrade to Rails 3.1 and keep all the functionality, and I had numerous problems. I have not yet found a configuration that worked for me in production mode, so I am currently working with development mode.

I took the following tips:

  • "Upgrade to Rails 3.1" from Railscast: very good, as usual, and told me how to modify production.rb , development.rb and application.rb to update the configuration of the asset pipeline. But I did not touch the compass, sassi and html5 template.
  • "Setting up the html template with Rails 3.1" This works best for me, but it doesn’t work because the ie_html method ie_html not available in production mode. Gemfile changes are noted below.
  • "It is impossible to get Rails 3.1, Compass, Sass, Blueprint, working on Geroku's cedars." This did not work for me at all, I had problems with assets, then it compiles. There, the attempt was to have everything global, because there is a dependency between Compass and the Html-Boilerplate, and the Html-Boilerplate must be global due to the ie_html method.
  • Each attempt to use only certain gems in the group :assets block failed. In most cases, the relationship between, for example, compass and sassi, compass and html5 template cannot be fulfilled.

So my question is: is there a working Gemfile that allows you to use Haml, Sass, Compass, Html5-Boilerplate and, of course, Rails 3.1 together?

The new Gemfile is 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 tried to create a new Rails 3.1 application and added an image resource there. Everything works fine there, so there is no difference between the development mode and the production mode. In my migrated application, I have the following state:

  • Works well in development mode.
  • Disable some of the html5 boilerplate stuff to work around production issues.
  • Until the precompiled images are found in the operating mode.
+4
source share
3 answers

My apologies at first for adding another answer, but I think the story helps others.

I tried again (thanks to @theanym comment) to create a new application with rails 3.1.1, html5-template, compass, sass and haml, and I found a working solution for development and production.

Here are the steps I took:

  • I started with a new application and followed the recipe "Configuring an html5 template with Rails 3.1" .
  • When I launched the application (in development mode), it worked well.
  • When I started working 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' 
  • Then I 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 appropriate part of the solution for me was to designate an additional argument for compass and html5-boilerplate :group => :production .

Then I had to pre-assemble the assets and I had to change style.scss to style.css.scss , but that was a little tweak. The application was tested with both development mode and production mode, and there seemed to be no errors.

0
source

I work on Kerok Kerok.

 gem "rails", "~> 3.1.0" gem 'sass-rails', "~> 3.1.0" group :assets do gem 'coffee-rails', "~> 3.1.0" gem 'uglifier' gem 'compass', '~> 0.12.alpha.0' gem 'html5-boilerplate' end 

But before git push heroku first precompiling locally with:

 RAILS_ENV=production bundle exec rake assets:precompile 

then add all public / assets to your git and commit repository. Then:

 git push heroku master 

Heroku will detect the file public/assets/manifest.yml and simply use these files.

This works for me, so it should work! Greetings

+2
source

Just to include some of the information that might help others, here is my current situation that works (more or less):

I will not invest any more time and wait for updates for Rails 3.1.1 and html5-template.

0
source

All Articles