admin管理员组

文章数量:1391925

I need to regularly send html pages to a client as standalone .html files with no external dependencies. The original pages are done with node.js and express and they contains several librairies such as High Charts. I have done the preparation manually until now, this includes:

  • Transform all images into blobs
  • Copy all external .js and .cs inside the page
  • Minimize where possible (standards librairies such as jQuery or Bootstrap...)

The result is a single .html file that can be opened without an internet connection and looks just like the original.

Is there any tool to do this automatically? If not, maybe I'll code it myself in Python. Do you have any remendation around that?

Thanks

I need to regularly send html pages to a client as standalone .html files with no external dependencies. The original pages are done with node.js and express and they contains several librairies such as High Charts. I have done the preparation manually until now, this includes:

  • Transform all images into blobs
  • Copy all external .js and .cs inside the page
  • Minimize where possible (standards librairies such as jQuery or Bootstrap...)

The result is a single .html file that can be opened without an internet connection and looks just like the original.

Is there any tool to do this automatically? If not, maybe I'll code it myself in Python. Do you have any remendation around that?

Thanks

Share Improve this question edited Jul 4, 2014 at 7:15 Joan-Diego Rodriguez asked Jul 4, 2014 at 6:50 Joan-Diego RodriguezJoan-Diego Rodriguez 2,5571 gold badge28 silver badges30 bronze badges 2
  • Do u really embed something like this into your page? And u dont have to be offensive. I am just looking for YOUR PROBLEM's solution! If u already know the answers why did u asked them in here. And try to embed bigger images in to your html like this and see the result ;) – obayhan Commented Jul 4, 2014 at 7:05
  • You are right. Look I need to send a single text file that has all functionalities. I know how to do it manually, I'm just looking for an automatic tool before I code one myself. Cheers – Joan-Diego Rodriguez Commented Jul 4, 2014 at 7:17
Add a ment  | 

2 Answers 2

Reset to default 4

Monolith is a CLI tool for saving plete web pages as a single HTML file

See https://github./Y2Z/monolith

With apologies to OP, as this answer is probably far too late for him, but I'm posting it to help anyone with a similar problem:

HTTrack is an open-source project that does almost exactly what you described, though it doesn't work perfectly on some of the more peculiar JS.

It saves the page with most of the JS, the major images, and everything that the page needs to appear plete. It can be configured to include or exclude the entire or partial JS, images, and CSS.

This does not import all of the JS and other content into the HTML file, but neatly organizes all of the content into one folder and corrects all of the paths to make the folder portable.

It also seems to have trouble grabbing some external sources that are protected, but if it is your local site and simply uses mon scripts like JQuery, you should be fine. When I tested it, it correctly downloaded all of my local CSS and any valid external CSS library that I incorporated, the JQuery and derivative scripts that I was using, and the embedded images.

Just to save everyone a question, the program by default saves the downloaded websites to C:\My Web Sites.

本文标签: javascriptSave HTML As Standalone Page Exporting ToolStack Overflow