fphilipe/premailer-rails3 — Issue #17: CSS helper fails with precompiled assets
Author: coutud
Created: 2012-01-28 16:17:28+00:00
State: open

If the application is running with precompiled assets (on heroku, by default, for example), and if config.assets.compile = false, then the css helper fails to load the given css.

## How to reproduce
Run `rake assets:precompile`, and launch a console in a mode where `config.assets.compile = false`.

```ruby
# The following can't be trusted
# On one of my files, I get an empty file
# On the other, it just fails because some required gems are only loaded in :asset mode
> Rails.application.assets.find_asset('application.css')
# throws an error, because some dependencies aren't there

# But the following works :
> helper.asset_path
"/assets/application-7e665a53800e4707726f7e685d167973.css"
```

The `stylesheet_link_tag` generated is with the public address (`/assets/application-7e..73.css`)
In `css_helper.rb`, we get `path='application-7e..73.css'` on line 36 (fine).

But then it stops working. The `asset` object is retrieved (some `Sprockets::BundledAsset`), but its body is empty ...
I guess the best chance here to read it is to directly read from this file ... but I haven't found an easy way to get its full path ...