Use already existing mechanism for assets_host
This commit is contained in:
parent
d53987c6e8
commit
3eb07394e7
|
@ -64,4 +64,5 @@ run Travis::Web::App.build(
|
||||||
pro: ENV['TRAVIS_PRO'],
|
pro: ENV['TRAVIS_PRO'],
|
||||||
code_climate: ENV['CODE_CLIMATE'],
|
code_climate: ENV['CODE_CLIMATE'],
|
||||||
code_climate_url: ENV['CODE_CLIMATE_URL'],
|
code_climate_url: ENV['CODE_CLIMATE_URL'],
|
||||||
|
assets_host: ENV['ASSETS_HOST']
|
||||||
)
|
)
|
||||||
|
|
|
@ -94,7 +94,6 @@ class Travis::Web::App
|
||||||
else
|
else
|
||||||
set_config(content, options) if config_needed?(file)
|
set_config(content, options) if config_needed?(file)
|
||||||
set_title(content) if index?(file)
|
set_title(content) if index?(file)
|
||||||
set_assets_host(content) if index?(file)
|
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
'Content-Length' => content.bytesize.to_s,
|
'Content-Length' => content.bytesize.to_s,
|
||||||
|
@ -169,7 +168,14 @@ class Travis::Web::App
|
||||||
end
|
end
|
||||||
|
|
||||||
string.gsub! %r{(src|href)="(?:\/?)((styles|scripts)\/[^"]*)"} do
|
string.gsub! %r{(src|href)="(?:\/?)((styles|scripts)\/[^"]*)"} do
|
||||||
%(#{$1}=#{opts[:alt] ? "#{S3_URL}/#{opts[:alt]}/#{$2}":"/#{$2}"})
|
src = if options[:assets_host]
|
||||||
|
"#{options[:assets_host].chomp('/')}/#{$2}"
|
||||||
|
elsif opts[:alt]
|
||||||
|
"#{S3_URL}/#{opts[:alt]}/#{$2}"
|
||||||
|
else
|
||||||
|
"/#{$2}"
|
||||||
|
end
|
||||||
|
%(#{$1}="#{src}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
<link rel="dns-prefetch" href="//api.github.com">
|
<link rel="dns-prefetch" href="//api.github.com">
|
||||||
<link rel="dns-prefetch" href="//www.gravatar.com">
|
<link rel="dns-prefetch" href="//www.gravatar.com">
|
||||||
<link rel="icon" type="image/png" href="/favicon.ico">
|
<link rel="icon" type="image/png" href="/favicon.ico">
|
||||||
<link rel="stylesheet" href="{{assets_host}}/styles/app.css">
|
<link rel="stylesheet" href="/styles/app.css">
|
||||||
<script src="{{assets_host}}/scripts/app.js"></script>
|
<script src="/scripts/app.js"></script>
|
||||||
<script>
|
<script>
|
||||||
minispade.require('travis')
|
minispade.require('travis')
|
||||||
Travis.run()
|
Travis.run()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user