forked from FoundKeyGang/FoundKey
Refactoring
This commit is contained in:
parent
d850b157f4
commit
50e65d292c
4 changed files with 11 additions and 24 deletions
|
@ -2,4 +2,4 @@ extends ../base
|
||||||
|
|
||||||
block head
|
block head
|
||||||
meta(name='viewport' content='width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no')
|
meta(name='viewport' content='width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no')
|
||||||
script(src=`/assets/auth/script.${version}.js` async defer)
|
script(src=`/assets/auth.${version}.js` async defer)
|
||||||
|
|
|
@ -12,32 +12,19 @@
|
||||||
const ua = navigator.userAgent.toLowerCase();
|
const ua = navigator.userAgent.toLowerCase();
|
||||||
const isMobile = /mobile|iphone|ipad|android/.test(ua);
|
const isMobile = /mobile|iphone|ipad|android/.test(ua);
|
||||||
|
|
||||||
isMobile ? mountMobile() : mountDesktop();
|
const app = isMobile ? 'mobile' : 'desktop';
|
||||||
|
|
||||||
/**
|
// Load app script
|
||||||
* Mount the desktop app
|
const script = document.createElement('script');
|
||||||
*/
|
script.setAttribute('src', `/assets/${app}.${VERSION}.${lang}.js`);
|
||||||
function mountDesktop() {
|
script.setAttribute('async', 'true');
|
||||||
const script = document.createElement('script');
|
script.setAttribute('defer', 'true');
|
||||||
script.setAttribute('src', `/assets/desktop/script.${VERSION}.${lang}.js`);
|
head.appendChild(script);
|
||||||
script.setAttribute('async', 'true');
|
|
||||||
script.setAttribute('defer', 'true');
|
|
||||||
head.appendChild(script);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
if (isMobile) {
|
||||||
* Mount the mobile app
|
|
||||||
*/
|
|
||||||
function mountMobile() {
|
|
||||||
const meta = document.createElement('meta');
|
const meta = document.createElement('meta');
|
||||||
meta.setAttribute('name', 'viewport');
|
meta.setAttribute('name', 'viewport');
|
||||||
meta.setAttribute('content', 'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no');
|
meta.setAttribute('content', 'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no');
|
||||||
head.appendChild(meta);
|
head.appendChild(meta);
|
||||||
|
|
||||||
const script = document.createElement('script');
|
|
||||||
script.setAttribute('src', `/assets/mobile/script.${VERSION}.${lang}.js`);
|
|
||||||
script.setAttribute('async', 'true');
|
|
||||||
script.setAttribute('defer', 'true');
|
|
||||||
head.appendChild(script);
|
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
extends ../base
|
extends ../base
|
||||||
|
|
||||||
block head
|
block head
|
||||||
script(src=`/assets/dev/script.${version}.js` async defer)
|
script(src=`/assets/dev.${version}.js` async defer)
|
||||||
|
|
|
@ -85,7 +85,7 @@ module.exports = (Object as any).entries(languages).map(([lang, locale]) => {
|
||||||
],
|
],
|
||||||
output: {
|
output: {
|
||||||
path: __dirname + '/built/web/assets',
|
path: __dirname + '/built/web/assets',
|
||||||
filename: `[name]/script.${version}.${lang}.js`
|
filename: `[name].${version}.${lang}.js`
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue