本工具从HTML文档中提取内联样式,并将其释放到外联CSS文件中,减少原HTML体积。 This tool extracts inline styles from an HTML document and creates an external CSS file, then updates the HTML file to link to the newly created CSS file.
点击下载Windows可执行文件版本:style_extractor.zip
在运行此工具之前,请确保你的计算机上已设置了Python环境。(或下载我的打包版本) Ensure you have a Python environment set up on your computer before running this tool.
直接下载的exe直接就可以使用了
如果下载了源码,在终端中执行以下命令: Execute the following command in the terminal:
python style_extractor.py
如果在当前目录中找到多个HTML文件,脚本会提示你选择一个进行处理。 The script will automatically search for an HTML file in the current directory. If it finds multiple HTML files, it will prompt you to choose one to process.
运行脚本后,你将得到两个文件: After running the script, you will obtain two files:
updated_
前缀的更新过的HTML文件。updated_
prefix added to the filename.styles.css
的新CSS文件。styles.css
by default.这两个文件将被保存在原HTML文件的相同目录中。 Both files will be saved in the same directory as the original HTML file.
styles.css
的重要文件,因为它将被覆盖。styles.css
in the directory, as it will be overwritten.<link>
引用CSS将保持不变。<link>
references to CSS in the HTML file will remain unchanged.如果你有任何改进意见或对额外功能的请求,请开一个问题或提交一个拉取请求。 If you have any suggestions for improvement or requests for additional features, please open an issue or submit a pull request.
此项目根据MIT许可证授权。 This project is licensed under the MIT License.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。