mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Fixed loading CDN assets via lazy loading
refs https://github.com/TryGhost/DevOps/issues/47 - in the event we supply a CDN URL, don't prefix the URL with anything as this will get auto-prefixed - if not, add the Ghost Admin root because the assets sit under there
This commit is contained in:
parent
97f24338bf
commit
67a8244811
@ -35,7 +35,7 @@ export default class LazyLoaderService extends Service {
|
||||
let script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.async = true;
|
||||
script.src = `${config.cdnUrl || this.ghostPaths.adminRoot}${url}`;
|
||||
script.src = `${config.cdnUrl ? '' : this.ghostPaths.adminRoot}${url}`;
|
||||
|
||||
let el = document.getElementsByTagName('script')[0];
|
||||
el.parentNode.insertBefore(script, el);
|
||||
@ -63,7 +63,7 @@ export default class LazyLoaderService extends Service {
|
||||
let link = document.createElement('link');
|
||||
link.id = `${key}-styles`;
|
||||
link.rel = alternate ? 'alternate stylesheet' : 'stylesheet';
|
||||
link.href = `${config.cdnUrl || this.ghostPaths.adminRoot}${url}`;
|
||||
link.href = `${config.cdnUrl ? '' : this.ghostPaths.adminRoot}${url}`;
|
||||
link.onload = () => {
|
||||
link.onload = null;
|
||||
if (alternate) {
|
||||
|
Loading…
Reference in New Issue
Block a user