Use CDN for js and css

This commit is contained in:
John Huang 2024-02-06 17:34:51 -08:00
parent 103429bd14
commit 4e4c564f99
No known key found for this signature in database
GPG Key ID: 7BEF1876FF3664D9
2 changed files with 14 additions and 20 deletions

View File

@ -9,7 +9,7 @@
<meta name="smartbanner:price-suffix-google" content=" - In Google Play">
<meta name="smartbanner:button" content="VIEW">
<meta name="smartbanner:close-label" content="Close">
<meta name="smartbanner:exclude-user-agent-regex" content="^.*(Windows NT|Safari).*$">
<link rel="stylesheet" href="node_modules/smartbanner.js/dist/smartbanner.min.css">
<script src="node_modules/smartbanner.js/dist/smartbanner.min.js"></script>
<meta name="smartbanner:exclude-user-agent-regex" content="^.*(Windows NT|Intel Mac OS X).*$">
<script src="https://cdn.jsdelivr.net/npm/smartbanner.js@1.22.0/dist/smartbanner.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/smartbanner.js@1.22.0/dist/smartbanner.min.css" rel="stylesheet">
<!-- Smartbanner: End configuration -->

View File

@ -3,18 +3,11 @@ import fs from 'fs/promises';
import path from 'path';
import { fileURLToPath } from 'url';
// const SMARTBANNER_APP_NAME = process.env.SMARTBANNER_APP_NAME;
// const SMARTBANNER_ORG_NAME = process.env.SMARTBANNER_ORG_NAME;
// const SMARTBANNER_ICON_URL = process.env.SMARTBANNER_ICON_URL;
// const SMARTBANNER_APPSTORE_URL = process.env.SMARTBANNER_APPSTORE_URL;
// const SMARTBANNER_GOOGLEPLAY_URL = process.env.SMARTBANNER_GOOGLEPLAY_URL;
const SMARTBANNER_APP_NAME = 'dYdX Chain';
const SMARTBANNER_ORG_NAME = 'dYdX';
const SMARTBANNER_ICON_URL =
'https://is1-ssl.mzstatic.com/image/thumb/Purple126/v4/1a/ba/5d/1aba5d13-e050-a69d-b758-68e349d822c1/AppIcon-1x_U007emarketing-0-7-0-85-220.png/246x0w.webp';
const SMARTBANNER_APPSTORE_URL = 'https://apps.apple.com/app/id6475599596';
const SMARTBANNER_GOOGLEPLAY_URL = undefined;
const SMARTBANNER_APP_NAME = process.env.SMARTBANNER_APP_NAME;
const SMARTBANNER_ORG_NAME = process.env.SMARTBANNER_ORG_NAME;
const SMARTBANNER_ICON_URL = process.env.SMARTBANNER_ICON_URL;
const SMARTBANNER_APPSTORE_URL = process.env.SMARTBANNER_APPSTORE_URL;
const SMARTBANNER_GOOGLEPLAY_URL = process.env.SMARTBANNER_GOOGLEPLAY_URL;
const currentPath = fileURLToPath(import.meta.url);
const projectRoot = path.dirname(currentPath);
@ -33,25 +26,26 @@ if (
smartbanner = smartbanner
.replace('SMARTBANNER_APP_NAME', SMARTBANNER_APP_NAME)
.replace('SMARTBANNER_ORG_NAME', SMARTBANNER_ORG_NAME)
.replace('SMARTBANNER_ICON_URL', SMARTBANNER_ICON_URL)
.replace('SMARTBANNER_ICON_URL', SMARTBANNER_ICON_URL);
/* hardcoded injection depending on whether the app is available on App Store and/or Google Play */
if (SMARTBANNER_APPSTORE_URL) {
smartbanner += `\n<meta name="smartbanner:button-url-apple" content="${SMARTBANNER_APPSTORE_URL}">`;
smartbanner = `\t<meta name="smartbanner:button-url-apple" content="${SMARTBANNER_APPSTORE_URL}">\n` + smartbanner;
}
if (SMARTBANNER_GOOGLEPLAY_URL) {
smartbanner += `\n<meta name="smartbanner:button-url-google" content="${SMARTBANNER_GOOGLEPLAY_URL}">`;
smartbanner = `\t<meta name="smartbanner:button-url-google" content="${SMARTBANNER_GOOGLEPLAY_URL}">\n` + smartbanner;
}
if (SMARTBANNER_APPSTORE_URL) {
if (SMARTBANNER_GOOGLEPLAY_URL) {
smartbanner += `\n<meta name="smartbanner:enabled-platforms" content="android,ios">`;
smartbanner = `\t<meta name="smartbanner:enabled-platforms" content="android,ios">\n` + smartbanner;
} else {
smartbanner += `\n<meta name="smartbanner:enabled-platforms" content="ios">`;
smartbanner = `\t<meta name="smartbanner:enabled-platforms" content="ios">\n` + smartbanner;
}
} else {
if (SMARTBANNER_GOOGLEPLAY_URL) {
smartbanner += `\n<meta name="smartbanner:enabled-platforms" content="android">`;
smartbanner = `\t<meta name="smartbanner:enabled-platforms" content="android">\n` + smartbanner;
}
}