Different behaviors for same rack stack in development and production environment

Hello !

I had to deploy a rails 3 app on heroku

app is using bare sass, and it is already known as a hassle (http://blog.heroku.com/archives/2009/8/18/heroku_sass/)

so I looked for what was said on web, and decided to offer serve sassed css from tmp dir, using Rack::Static, as first option (considering another one at the same time)

#1

First try was to drop in config/initializers/sass.rb

Sass::Plugin.options[:css_location] = ‘tmp/stylesheets’

Rails::Application.middleware.use Rack::Static, :root => ‘tmp’, :urls => [’/stylesheets’]

It works on development env, generating tmp/stylesheets/base.css then rack it up

On production, what I saw was :

  • server runs for 30s

  • client receive empty base.css

ouch!, ugly rendering!

So same rack stack produced different behaviors on development and production

#2

moving Rack::Static from initializer to top of config.ru produce consistent behavior on both env

I retained this one now

Does someone has a clue on why #1 produce different behaviors in development and production ?

Curious, Thierry