mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05: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
dc2c8330af
commit
999425ccf6
1 changed files with 2 additions and 2 deletions
|
@ -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…
Add table
Reference in a new issue