Webpack-enabled web app that bundles all JS and CSS and outputs a single inlined public/index.html
.
- Install:
npm install
- Build once:
npm run build
- Watch mode:
npm run build:watch
The build writes topublic/
. Onlyindex.html
remains after inlining; JS and CSS are embedded directly.
html-webpack-plugin
generatesindex.html
fromsrc/index.html
.mini-css-extract-plugin
emits CSS files, which we then inline.- A small custom plugin (
webpack/InlineAssetsPlugin.js
) replaces injected<link>
and<script>
tags with<style>
and inline<script>
content and removes the original assets, leaving a single file output.
src/
— put your.html
,.js
, and.css
here.public/
— build output (singleindex.html
).webpack/InlineAssetsPlugin.js
— the inlining plugin.webpack.config.js
— build configuration.
- This setup focuses on inlining HTML, JS, and CSS. If you use images or other assets, consider converting them to data URLs or adjusting
webpack.config.js
to inline them asasset/inline
so the output remains a single file.