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
2 Answers
Reset to default 4Monolith 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
版权声明:本文标题:javascript - Save HTML As Standalone Page: Exporting Tool? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744739576a2622529.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论