Skip to content
Browse files

Fix errors in CSS path resolution

  • Loading branch information...
1 parent 4607ab3 commit cc985ffb6dce1da51d121ccbb4b0d4bf387fedb7 @fphilipe fphilipe committed Sep 29, 2011
Showing with 9 additions and 5 deletions.
  1. +9 −5 lib/premailer-rails3/css_helper.rb
View
14 lib/premailer-rails3/css_helper.rb
@@ -27,18 +27,22 @@ def load_css_at_path(path)
if Rails.env.development? or not @@css_cache.include? path
@@css_cache[path] =
if defined? Hassle and Rails.configuration.middleware.include? Hassle
- file = path == :default ? 'stylesheets/email.css' : path
- File.read("#{Rails.root}/tmp/hassle/#{file}")
+ file = path == :default ? '/stylesheets/email.css' : path
+ File.read("#{Rails.root}/tmp/hassle#{file}")
elsif Rails.configuration.try(:assets).try(:enabled)
file = if path == :default
'email.css'
else
path.sub("#{Rails.configuration.assets.prefix}/", '')
end
- Rails.application.assets.find_asset(file).body
+ if asset = Rails.application.assets.find_asset(file)
+ asset.body
+ else
+ raise "Couldn't find asset #{file} for premailer-rails3."
+ end
else
- file = path == :default ? 'stylesheets/email.css' : path
- File.read("#{Rails.root}/public/#{file}")
+ file = path == :default ? '/stylesheets/email.css' : path
+ File.read("#{Rails.root}/public#{file}")
end
end

0 comments on commit cc985ff

Please sign in to comment.
Something went wrong with that request. Please try again.