Permalink
Browse files

Added more regex, because if that doesn't solve your problem, that do…

…esn't solve your problem
  • Loading branch information...
1 parent cef05c7 commit a482ea53c13e3972f0bd7379ff78ef757628f263 @ivanvanderbyl ivanvanderbyl committed Feb 2, 2012
@@ -30,7 +30,14 @@ def load_css_from_asset_pipeline!
end
def process_stylesheet_url(href)
- href.to_s.sub(/\?[0-9a-zA-Z]+$/, '').sub(/^\/assets\//, '')
+ # Example stylesheet url: email-1bd4488901bfc2f2ccf4f044fc9154a6.css
+ href = href.to_s.sub(/\?[0-9a-zA-Z]+$/, '').sub(/^\/assets\//, '')
+
+ if href =~ /(\w+)\-(?:[0-9a-zA-Z]{32})\.([a-z]{3})/
+ href = href.gsub(/(\w+)\-(?:[0-9a-zA-Z]{32})\.([a-z]{3})/, [$1,$2].join('.'))
+ end
+
+ return href
end
end
@@ -4,7 +4,7 @@
<title>Notification_mailer.html</title>
<%#= stylesheet_link_tag "notification_mailer" %>
- <link rel="stylesheet" href="/assets/notification_mailer.css?jHUy87ybhjs876" />
+ <link rel="stylesheet" href="/assets/notification_mailer-1bd4488901bfc2f2ccf4f044fc9154a6.css" />
</head>
<body>
@@ -57,7 +57,7 @@ def parse_html_to_doc(html)
end
it 'should include asset path for stylesheet in header' do
- processor.html_part.body.should match /\<link(.+)href\=\"\/assets\/notification_mailer\.css\?(\w+)\"(.+)\>/
+ processor.html_part.body.should match /\<link(.+)href\=\"\/assets\/(\w+)\-(?:[0-9a-zA-Z]{32})\.([a-z]{3})\"(.+)\>/
end
it 'should have inlined css version without stylesheet links' do

0 comments on commit a482ea5

Please sign in to comment.