File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 11require 'premailer'
22
3- Premailer . class_eval do
3+ module LoadFileWithRailsPath
44 protected
55 # When using the 'stylesheet_link_tag' helper in Rails, css URIs are given with
66 # a leading slash and a cache buster (e.g. ?12412422).
77 # This override handles these cases, while falling back to the default implementation.
8- def load_css_from_local_file_with_rails_path !( path )
8+ def load_css_from_local_file !( path )
99 # Remove query string and the path
1010 clean_path = path . sub ( /\? .*$/ , '' ) . sub ( %r(^https?://[^/]*/) , '' )
1111 rails_path = Rails . root . join ( 'public' , clean_path )
@@ -14,10 +14,12 @@ def load_css_from_local_file_with_rails_path!(path)
1414 elsif ( asset = Rails . application . assets . find_asset ( clean_path . sub ( "#{ Rails . configuration . assets . prefix } /" , '' ) ) )
1515 load_css_from_string ( asset . source )
1616 else
17- load_css_from_local_file_without_rails_path! ( path )
17+ super ( path )
1818 end
1919 end
20- alias_method_chain :load_css_from_local_file! , :rails_path
20+ end
2121
22+ class Premailer
23+ prepend LoadFileWithRailsPath
2224end
2325
You can’t perform that action at this time.
0 commit comments