Sha256: 0470adf347a527341f829439c0ec8aa8fd7982d92f28cdcfd1281eb4ca5289e2
Contents?: true
Size: 888 Bytes
Versions: 1
Compression:
Stored size: 888 Bytes
Contents
require 'premailer' Premailer.class_eval do protected # When using the 'stylesheet_link_tag' helper in Rails, css URIs are given with # a leading slash and a cache buster (e.g. ?12412422). # This override handles these cases, while falling back to the default implementation. def load_css_from_local_file_with_rails_path!(path) # Remove query string and the path clean_path = path.sub(/\?.*$/, '').sub(%r(^https?://[^/]*/), '') rails_path = Rails.root.join('public', clean_path) if File.exist?(rails_path) load_css_from_string(File.read(rails_path)) elsif (asset = Rails.application.assets.find_asset(clean_path.sub("#{Rails.configuration.assets.prefix}/", ''))) load_css_from_string(asset.source) else load_css_from_local_file_without_rails_path!(path) end end alias_method_chain :load_css_from_local_file!, :rails_path end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
actionmailer_inline_css-1.5.3 | lib/overrides/premailer/premailer.rb |