mvp for cdn

This commit is contained in:
Henry Oswald 2016-07-18 14:05:07 +01:00
parent 0576380811
commit c21549220c
7 changed files with 23 additions and 8 deletions

View file

@ -16,6 +16,15 @@ jsPath =
else
"/js/"
imgPath = "/img/"
cssPath = "/stylesheets/"
if Settings.cdn?.web?.host?
jsPath = "#{Settings.cdn?.web?.host}#{jsPath}"
imgPath = "#{Settings.cdn?.web?.host}#{imgPath}"
cssPath = "#{Settings.cdn?.web?.host}#{cssPath}"
logger.log "Generating file fingerprints..."
for path in [
"#{jsPath}libs/require.js",
@ -46,6 +55,8 @@ module.exports = (app, webRouter, apiRouter)->
webRouter.use (req, res, next)->
res.locals.jsPath = jsPath
res.locals.imgPath = imgPath
res.locals.cssPath = cssPath
next()
webRouter.use (req, res, next)->

View file

@ -3,7 +3,7 @@ html(itemscope, itemtype='http://schema.org/Product')
head
title Something went wrong
link(rel="icon", href="/favicon.ico")
link(rel='stylesheet', href='/stylesheets/style.css')
link(rel='stylesheet', href=cssPath+'/style.css')
link(href="//netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css",rel="stylesheet")
body
.content
@ -12,7 +12,7 @@ html(itemscope, itemtype='http://schema.org/Product')
.col-md-8.col-md-offset-2.text-center
.page-header
h2 Oh dear, something went wrong.
p: img(src="/img/lion-sad-128.png", alt="Sad Lion")
p: img(src=imgPath+"lion-sad-128.png", alt="Sad Lion")
p
| Something went wrong with your request, sorry. Our staff are probably looking into this, but if it continues, please contact us at #{settings.adminEmail}
p

View file

@ -18,7 +18,7 @@ html(itemscope, itemtype='http://schema.org/Product')
title= translate(title) + ' - ShareLaTeX, '+translate("online_latex_editor")
link(rel="icon", href="/favicon.ico")
link(rel='stylesheet', href='/stylesheets/style.css?fingerprint='+fingerprint('/stylesheets/style.css'))
link(rel='stylesheet', href=cssPath+'/style.css?fingerprint='+fingerprint('/stylesheets/style.css'))
if settings.i18n.subdomainLang
each subdomainDetails in settings.i18n.subdomainLang

View file

@ -135,7 +135,7 @@
p
span Get Dropbox Sync
p
img(src="/img/dropbox/simple_logo.png")
img(src=imgPath+"dropbox/simple_logo.png")
p
a(href="/user/subscription/plans", sixpack-convert="left-menu-upgraed-rotation").btn.btn-primary #{translate("upgrade")}
p.small.text-centered
@ -148,7 +148,7 @@
p
span Get Github Sync
p
img(src="/img/github/octocat.jpg")
img(src=imgPath+"github/octocat.jpg")
p
a(href="/user/subscription/plans", sixpack-convert="left-menu-upgraed-rotation").btn.btn-primary #{translate("upgrade")}
p.small.text-centered

View file

@ -30,10 +30,10 @@ block content
| Henry and James
.portraits
span.img-circle
img(src="/img/about/henry_oswald.jpg")
img(src=imgPath+"about/henry_oswald.jpg")
|  
span.img-circle
img(src="/img/about/james_allen.jpg")
img(src=imgPath+"about/james_allen.jpg")
p
a.btn.btn-primary(href="/project") < #{translate("back_to_your_projects")}

View file

@ -2,7 +2,7 @@
span(ng-controller="TranslationsPopupController", ng-cloak)
.translations-message(ng-hide="hidei18nNotification")
a(href=recomendSubdomain.url+currentUrl) !{translate("click_here_to_view_sl_in_lng", {lngName:"<strong>" + translate(recomendSubdomain.lngCode) + "</strong>"})}
img(src="/img/flags/24/#{recomendSubdomain.lngCode}.png")
img(src=imgPath+"flags/24/#{recomendSubdomain.lngCode}.png")
button(ng-click="dismiss()").close.pull-right
span(aria-hidden="true") &times;
span.sr-only #{translate("close")}

View file

@ -114,6 +114,10 @@ module.exports = settings =
showSocialButtons: false
showComments: false
# cdn:
# web:
# host:"https://www.somewhere.com"
# Where your instance of ShareLaTeX can be found publically. Used in emails
# that are sent out, generated links, etc.
siteUrl : siteUrl = 'http://localhost:3000'