Spaces:
Sleeping
Sleeping
utils.js — GUI Build Script (Overview)
This file is responsible for:
- Generating production and development builds of the GUI
- Merging and minifying JS/CSS files
- Converting icon files to base64
- Bundling core GUI logic using Webpack
- Generating the HTML structure dynamically for development mode
Main Functions
🔧 build(options)
Runs the full GUI build process.
Steps it performs:
- Deletes and recreates the
/distfolder - Merges JavaScript libraries →
dist/libs.js - Converts all
src/icons/*.svg/pngto base64 → stores inwindow.icons - Merges and minifies CSS →
dist/bundle.min.css - Uses Webpack to bundle
src/index.jsand dependencies →dist/main.js - Prepends
window.gui_env = "prod"and writes it asdist/gui.js - Copies static assets like images, fonts, manifest, etc.
🛠️ generateDevHtml(options)
Dynamically builds the HTML string for development mode.
What it includes:
- Meta tags (SEO + social)
- CSS & JS includes (based on env)
- Inline base64 image data
- JS entry points for dev (
/index.js) or prod (/dist/gui.js)
Related Files
| File | Role |
|---|---|
build.js |
Just imports and calls build() |
BaseConfig.cjs |
Provides Webpack config used in build |
static-assets.js |
Lists paths to JS, CSS, icons, etc |