mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-15 04:34:00 -05:00
16 lines
392 B
Ruby
16 lines
392 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
module PremailerWebpackStrategy
|
||
|
def load(url)
|
||
|
if Webpacker.dev_server.running?
|
||
|
url = File.join("#{Webpacker.dev_server.protocol}://#{Webpacker.dev_server.host_with_port}", url)
|
||
|
HTTP.get(url).to_s
|
||
|
else
|
||
|
url = url[1..-1] if url.start_with?('/')
|
||
|
File.read(Rails.root.join('public', url))
|
||
|
end
|
||
|
end
|
||
|
|
||
|
module_function :load
|
||
|
end
|