skip to Main Content

I have a simple web app project that performs one task and is built with a single HTML, CSS (Bootstrap), JS, and some images. This program is meant to be used locally, offline, and in the browser only.

Is there a way I can merge/concatenate all of the HTML, CSS, JS, and image files into a single HTML file?

Ideally, I’d like to have one HTML file that contains all the necessary code and resources so the app can be used offline by just opening the HTML file in a browser.

The main requirements are:

All CSS, JS, and images are contained within the single HTML file
No external file requests are made that require a web connection
The HTML file is self-contained and can be opened locally on a computer
What is the best way to concatenate/merge everything into a single HTML file for offline use?

2

Answers


  1. Yes, you can add js files into <script></script> tag

    Place CSS marks into <style></style> tag like

    <style>
       body,.s-topbar{margin-top:1.9em;}
       p{display: block;font-size:2em;}
    </style> 
    

    Images your can convert to BASE64 code and include like:

    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4
      //8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />
    

    Really it’s simple to merge all js, css and images into a single html file

    Login or Signup to reply.
  2. Simply you should add css in head section with style tag and js with script tag and upload images on drive and place their url where you want your image thus you can make a single html file containing all

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search