[英]Is there a way to get and display the file size of all the resources on a website? (img, .css, .js, etc.)
[英]collect all the js css and img resources used in a html file
我想寫一個npm包來本地化一個HTML網址。
1.使用html url下載html頁面
2.解析html文件,提取html中使用的所有js,css和img文件以及本地這些資源。
3.如果這些js,css和img文件使用一些外部資源,則本地化這些資源。 例如,在css中提取背景圖像。
第一和第二個要求很容易滿足。 但我不知道最后一個。 我可以解析所有的css文件並本地化其中使用的資源。 但是我如何解析js文件?
例如:如果js在html dom中添加了'script src = XXX'標簽,我該如何提取src?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.