mirror of
https://github.com/locomotivemtl/locomotive-boilerplate.git
synced 2026-01-15 00:55:08 +08:00
Config namespaces
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"version": 1675955478084
|
||||
"version": 1680721594993
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import * as modules from './modules';
|
||||
import globals from './globals';
|
||||
import { debounce } from './utils/tickers'
|
||||
import { $html } from './utils/dom';
|
||||
import { ENV, FONTS, CUSTOM_EVENTS, CSS_CLASS } from './config'
|
||||
import { ENV, FONT, CUSTOM_EVENT, CSS_CLASS } from './config'
|
||||
import { isFontLoadingAPIAvailable, loadFonts } from './utils/fonts';
|
||||
|
||||
const app = new modular({
|
||||
@@ -36,7 +36,7 @@ function init() {
|
||||
$html.classList.remove(CSS_CLASS.LOADING);
|
||||
|
||||
// Bind window resize event with default vars
|
||||
const resizeEndEvent = new CustomEvent(CUSTOM_EVENTS.RESIZE_END)
|
||||
const resizeEndEvent = new CustomEvent(CUSTOM_EVENT.RESIZE_END)
|
||||
window.addEventListener('resize', () => {
|
||||
$html.style.setProperty('--vw', `${document.documentElement.clientWidth * 0.01}px`)
|
||||
debounce(() => {
|
||||
@@ -48,7 +48,7 @@ function init() {
|
||||
* Eagerly load the following fonts.
|
||||
*/
|
||||
if (isFontLoadingAPIAvailable) {
|
||||
loadFonts(FONTS.EAGER_FONTS, ENV.IS_DEV).then((eagerFonts) => {
|
||||
loadFonts(FONT.EAGER_FONTS, ENV.IS_DEV).then((eagerFonts) => {
|
||||
$html.classList.add(CSS_CLASS.FONTS_LOADED);
|
||||
|
||||
if (ENV.IS_DEV) {
|
||||
|
||||
@@ -41,16 +41,16 @@ const CUSTOM_EVENT = Object.freeze({
|
||||
})
|
||||
|
||||
// Fonts parameters
|
||||
const FONTS = Object.freeze({
|
||||
const FONT = Object.freeze({
|
||||
EAGER: [
|
||||
{ family: 'Source Sans', style: 'normal', weight: 400 },
|
||||
{ family: 'Source Sans', style: 'normal', weight: 700 },
|
||||
],
|
||||
})
|
||||
|
||||
export default {
|
||||
export {
|
||||
ENV,
|
||||
CSS_CLASS,
|
||||
CUSTOM_EVENT,
|
||||
FONTS,
|
||||
FONT,
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { module } from 'modujs';
|
||||
import { FONTS } from '../config';
|
||||
import { FONT } from '../config';
|
||||
import { whenReady } from '../utils/fonts';
|
||||
|
||||
export default class extends module {
|
||||
@@ -8,7 +8,7 @@ export default class extends module {
|
||||
}
|
||||
|
||||
init() {
|
||||
whenReady(FONTS.EAGER).then((fonts) => this.onFontsLoaded(fonts));
|
||||
whenReady(FONT.EAGER).then((fonts) => this.onFontsLoaded(fonts));
|
||||
}
|
||||
|
||||
onFontsLoaded(fonts) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const $html = document.documentElement
|
||||
const $body = document.body
|
||||
|
||||
export default {
|
||||
export {
|
||||
$html,
|
||||
$body,
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CSS_CLASS } from './config'
|
||||
import { CSS_CLASS } from '../config'
|
||||
|
||||
/**
|
||||
* Get an image meta data
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user