load

Dynamic file and script loading utilities for managing modules, components, and resources.

Functions

Function
Description
Example

all

Load all files from glob object

dphelper.load.all(import.meta.glob('./**/*.ts'))

file

Load a specific file

dphelper.load.file(path)

fileToElement

Load file content into element

dphelper.load.fileToElement('#target', '/content.html')

script

Dynamically load scripts

dphelper.load.script(['/app.js'])

toJson

Create JSON from folder glob

dphelper.load.toJson(glob, 'routes')

Description

Dynamic loading utilities:

  • Module Loading - Load ES modules via Vite/esbuild

  • File Loading - Fetch and inject content

  • Script Loading - Dynamic script injection

  • Caching - Optional result caching

Usage Examples

Load All Modules (Vite)

Load File to Element

Dynamic Script Loading

Create JSON from Glob

Advanced Usage

Component Lazy Loading

Dynamic Module Loading

Details

  • Author: Dario Passariello

  • Version: 0.0.3

  • Creation Date: 20210101

  • Last Modified: 20260228

  • Environment: Client-side only (browser)


Automatically generated document

Last updated