Provide the static resource path via index

When the side loader for the syntax library was written, it needed to be
compatible with CDN configurations, but at that time the simplest way to
determine the CDN's path was by extracting it from the URL of the
application's main link element.

Since that time, the CDN path is provided to the page's index Soy
template using a trusted string. This can be safely inserted into the
page's JS block of constants and provided to the loader more directly.

Change-Id: I3a3432c1bf99a650645a7adf1d6979a900988ac4
This commit is contained in:
Wyatt Allen
2018-05-21 14:17:07 -07:00
parent e9bf51941a
commit e60796ac6f
2 changed files with 5 additions and 0 deletions

View File

@@ -102,6 +102,10 @@
* @return {string}
*/
_getLibRoot() {
// TODO(wyatta): Remove the remainder of this method logic once the
// STATIC_RESOURCE_PATH variable is being provided generally.
if (window.STATIC_RESOURCE_PATH) { return window.STATIC_RESOURCE_PATH; }
if (this._cachedLibRoot) { return this._cachedLibRoot; }
const appLink = document.head

View File

@@ -33,6 +33,7 @@
window.CLOSURE_NO_DEPS = true;
{if $canonicalPath != ''}window.CANONICAL_PATH = '{$canonicalPath}';{/if}
{if $versionInfo}window.VERSION_INFO = '{$versionInfo}';{/if}
{if $staticResourcePath != ''}window.STATIC_RESOURCE_PATH = '{$staticResourcePath}';{/if}
</script>{\n}
{if $faviconPath}