Standalone project for building a single offline HTML bundle for WebView apps.
It inlines external CSS, JavaScript, and file-based resources into one output file.
Run directly without local installation:
npx @skynes/html-builder --helpBuild with explicit input/output:
npx @skynes/html-builder --input ./web/index.html --output ./dist/web.bundle.htmlBuild using config targets:
npx @skynes/html-builder --config ./build.config.json --target android
npx @skynes/html-builder --config ./build.config.json --target allUse inside other repositories (example):
npx @skynes/html-builder --config ./html-bundle.config.json --target androidAvailable target values:
- any key from
targetsin config (for example:android,windows) allto build all targetsdefault(used when no--targetis passed)
Install dependencies:
npm installRun build:
npm run buildRun with direct script call:
node build.js --input /absolute/or/relative/source.html --output /absolute/or/relative/bundle.html
node build.js --config ./build.config.json --target androidShow help:
npm run build:help- Reads source HTML.
- Inlines external
<link rel="stylesheet">files into<style>tags. - Inlines external
<script src="...">files. - Rewrites
url(...)inside CSS todata:URLs when possible. - Optionally processes
db_localobject (if present) and converts file-like values todata:URLs. - Applies safe HTML minification (outside
script/style/pre/textareablocks). - Writes a final bundle file for offline WebView usage.
- Relative file paths are resolved from the source HTML file directory.
- HTTP/HTTPS assets are downloaded and embedded as
data:URLs. - If
db_localdoes not exist in your HTML scripts, the build still succeeds.
Keep this builder as a standalone repository and store environment-specific paths in a local config file.
- Copy
build.config.example.jsontobuild.config.json. - Adjust
inputandtargetspaths for your local projects (Android/Windows/etc.). - Run build with config:
node build.js --config ./build.config.json --target androidThis keeps the builder source independent while still producing bundles directly into your target repositories.
If you find a bug or have an improvement suggestion, please open an issue.