Skip to content

Commit

Permalink
Add setLibs back
Browse files Browse the repository at this point in the history
  • Loading branch information
TsayAdobe committed Nov 20, 2024
1 parent d09e014 commit 3fc733e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
13 changes: 13 additions & 0 deletions acrobat/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ document.querySelectorAll('a').forEach((p, idx) => {
}
});

/**
* The decision engine for where to get Milo's libs from.
*/
const setLibs = (prodLibs, location) => {
const { hostname, search } = location || window.location;
// eslint-disable-next-line compat/compat
const branch = new URLSearchParams(search).get('milolibs') || 'main';
if (branch === 'main' && hostname === 'www.stage.adobe.com') return 'https://www.stage.adobe.com/libs';
if (!(hostname.includes('.hlx.') || hostname.includes('local') || hostname.includes('stage'))) return prodLibs;
if (branch === 'local') return 'http://localhost:6456/libs';
return branch.includes('--') ? `https://${branch}.hlx.live/libs` : `https://${branch}--milo--adobecom.hlx.live/libs`;
};

const getLocale = (locales, pathname = window.location.pathname) => {
if (!locales) {
return { ietf: 'en-US', tk: 'hah7vzn.css', prefix: '' };
Expand Down
20 changes: 0 additions & 20 deletions test/scripts/scripts-preloads.test.js

This file was deleted.

0 comments on commit 3fc733e

Please sign in to comment.