Sha256: d568899e978f6b2441c3ba7dab88b224847aa9359ac91018aa939a2b7cd28236

Contents?: true

Size: 663 Bytes

Versions: 9

Compression:

Stored size: 663 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)
    rails_path = Rails.root.join("public", path.sub(/\?[0-9a-zA-Z]+$/, '').sub(/^\//, '')).to_s
    if File.exist?(rails_path)
      load_css_from_string(File.read(rails_path))
    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

9 entries across 9 versions & 1 rubygems

Version Path
actionmailer_inline_css-1.5.2 lib/overrides/premailer/premailer.rb
actionmailer_inline_css-1.5.1 lib/overrides/premailer/premailer.rb
actionmailer_inline_css-1.5.0 lib/overrides/premailer/premailer.rb
actionmailer_inline_css-1.4.0 lib/overrides/premailer/premailer.rb
actionmailer_inline_css-1.3.1 lib/overrides/premailer/premailer.rb
actionmailer_inline_css-1.2.1 lib/overrides/premailer/premailer.rb
actionmailer_inline_css-1.3.0 lib/overrides/premailer/premailer.rb
actionmailer_inline_css-1.2.0 lib/overrides/premailer/premailer.rb
actionmailer_inline_css-1.1.0 lib/overrides/premailer/premailer.rb