将CSS / Javascript内嵌到HTML文件中 [英] Inline CSS/Javascript into a HTML file
问题描述
我正在寻找一个简单的命令行脚本/程序来自动内联 html文件的所有外部CSS和javascript参考。我基本上想创建一个适合通过电子邮件发送的独立HTML文件。另一个好处是,它是否还可以内嵌图像作为数据:UIR,但这部分并不那么重要。
I am looking for a simple commandline script/program to automatically "inline" all external css and javascript references for a html file. I basically want to create a single self-contained html file suitable for sending via E-Mail. An additional bonus would be if it could also inline images as data: UIRs, but that part is not so important.
推荐答案
编辑:我写了一些Python脚本很有趣。似乎效果很好:
或者您仍然可以尝试使用:
Or you can still try with :
前端编译器会执行类似的操作,但它暗示着javascript。您也可以使用 premailer 在线解决方案。最后,您有一个 Python 和一个 Ruby 脚本来完成。
Front compiler does something like that but it implies javascript. You have an online solution as well, with premailer. Finally you have a Python and a Ruby script to do it.
这篇关于将CSS / Javascript内嵌到HTML文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!