about summary refs log tree commit diff
path: root/lib/mastodon/premailer_webpack_strategy.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-01-20 01:32:21 +0100
committerGitHub <noreply@github.com>2018-01-20 01:32:21 +0100
commit872a0d5bd801c998d911f7da582a60d2f714a710 (patch)
treeca4fee834e05c620b46c1660a579828d1c397193 /lib/mastodon/premailer_webpack_strategy.rb
parent01421999aeee60c1bb24a8509a9d1b9ebe34b4d9 (diff)
Improve HTML e-mails based on Litmus tests (#6301)
* Use PNG images in HTML e-mails

* Make webpack use URLs with host so fonts load inside HTML e-mails

Convert this back to a relative URL in the premailer CSS loader
since local requests are quicker

* Improve responsive design

* Add missing PNG icon
Diffstat (limited to 'lib/mastodon/premailer_webpack_strategy.rb')
-rw-r--r--lib/mastodon/premailer_webpack_strategy.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/mastodon/premailer_webpack_strategy.rb b/lib/mastodon/premailer_webpack_strategy.rb
index 4ea3ce80c..84d83cc66 100644
--- a/lib/mastodon/premailer_webpack_strategy.rb
+++ b/lib/mastodon/premailer_webpack_strategy.rb
@@ -2,6 +2,9 @@
 
 module PremailerWebpackStrategy
   def load(url)
+    public_path_host = ENV['ASSET_HOST'] || ENV['LOCAL_DOMAIN']
+    url = url.gsub(/\A\/\/#{public_path_host}/, '')
+
     if Webpacker.dev_server.running?
       url = File.join("#{Webpacker.dev_server.protocol}://#{Webpacker.dev_server.host_with_port}", url)
       HTTP.get(url).to_s