Skip to content

Instantly share code, notes, and snippets.

@dimroc
Created May 7, 2015 14:19
Show Gist options
  • Select an option

  • Save dimroc/eeb519c36152dbc133ae to your computer and use it in GitHub Desktop.

Select an option

Save dimroc/eeb519c36152dbc133ae to your computer and use it in GitHub Desktop.
class FastlyAssetsProvider
include Roadie::AssetProvider
def find_stylesheet(name)
Rails.logger.info("## FastlyAssetsProvider retrieving asset named: #{name}")
asset_host = Rails.application.config.action_mailer.asset_host
return nil unless asset_host.present?
uri = URI(name)
uri.scheme = 'https'
response = URI.parse(uri.to_s).read
Roadie::Stylesheet.new(name, response)
rescue OpenURI::HTTPError
rescue NoMethodError
nil
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment