mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Configured Admin to use CDN URLs for lazy-loaded assets
refs https://github.com/TryGhost/DevOps/issues/47 - this allows Ghost to use a different URL for lazy-loaded assets, so it can be loaded from a CDN
This commit is contained in:
parent
375d723878
commit
e87c994bba
2 changed files with 4 additions and 5 deletions
|
@ -32,12 +32,10 @@ export default class LazyLoaderService extends Service {
|
|||
}
|
||||
|
||||
let scriptPromise = new RSVP.Promise((resolve, reject) => {
|
||||
let {adminRoot} = this.ghostPaths;
|
||||
|
||||
let script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.async = true;
|
||||
script.src = `${adminRoot}${url}`;
|
||||
script.src = `${config.cdnUrl || this.ghostPaths.adminRoot}${url}`;
|
||||
|
||||
let el = document.getElementsByTagName('script')[0];
|
||||
el.parentNode.insertBefore(script, el);
|
||||
|
@ -65,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 = `${this.ghostPaths.adminRoot}${url}`;
|
||||
link.href = `${config.cdnUrl || this.ghostPaths.adminRoot}${url}`;
|
||||
link.onload = () => {
|
||||
link.onload = null;
|
||||
if (alternate) {
|
||||
|
|
|
@ -5,6 +5,7 @@ module.exports = function (environment) {
|
|||
let ENV = {
|
||||
modulePrefix: 'ghost-admin',
|
||||
environment,
|
||||
cdnUrl: process.env.GHOST_CDN_URL || '',
|
||||
rootURL: '',
|
||||
locationType: 'trailing-hash',
|
||||
EmberENV: {
|
||||
|
@ -33,7 +34,7 @@ module.exports = function (environment) {
|
|||
|
||||
'ember-simple-auth': { },
|
||||
|
||||
'ember-websockets': {
|
||||
'ember-websockets': {
|
||||
socketIO: true
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue