1
0
mirror of https://github.com/locomotivemtl/locomotive-boilerplate.git synced 2026-01-15 00:55:08 +08:00

Move grid helper call to global.js

This commit is contained in:
arnvvd
2022-10-06 14:01:59 -04:00
committed by Deven Caron
parent 2e3db21ec8
commit eead1d27cd
5 changed files with 48 additions and 22 deletions

View File

@@ -1,3 +1,3 @@
{
"version": 1667240712883
"version": 1667240825414
}

View File

@@ -5,15 +5,6 @@ import { html } from './utils/environment';
import config from './config'
import { isFontLoadingAPIAvailable, loadFonts } from './utils/fonts';
// Dynamic imports for development mode only
let gridHelper;
(async () => {
if (config.IS_DEV) {
const gridHelperModule = await import('./utils/grid-helper');
gridHelper = gridHelperModule?.gridHelper;
}
})();
const app = new modular({
modules: modules,
});
@@ -48,5 +39,22 @@ function init() {
html.classList.add('is-ready');
html.classList.remove('is-loading');
gridHelper?.();
/**
* Eagerly load the following fonts.
*/
if (isFontLoadingAPIAvailable) {
loadFonts(EAGER_FONTS, config.IS_DEV).then((eagerFonts) => {
html.classList.add('fonts-loaded');
if (config.IS_DEV) {
console.group('Eager fonts loaded!', eagerFonts.length, '/', document.fonts.size);
console.group('State of eager fonts:')
eagerFonts.forEach((font) => console.log(font.family, font.style, font.weight, font.status/*, font*/))
console.groupEnd()
console.group('State of all fonts:')
document.fonts.forEach((font) => console.log(font.family, font.style, font.weight, font.status/*, font*/))
console.groupEnd()
}
});
}
}

View File

@@ -1,5 +1,23 @@
import svg4everybody from 'svg4everybody';
import config from './config';
export default function() {
// Dynamic imports for development mode only
let gridHelper;
(async () => {
if (config.IS_DEV) {
const gridHelperModule = await import('./utils/grid-helper');
gridHelper = gridHelperModule?.gridHelper;
}
})();
export default function () {
/**
* Use external SVG spritemaps
*/
svg4everybody();
/**
* Add grid helper
*/
gridHelper?.();
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long