Is there a ready-made tool or utility that does that already
是否有现成的工具或实用程序
1 个解决方案
#1
You could just open the CSS file and just embed its content into a style tag.
您只需打开CSS文件,然后将其内容嵌入到样式标记中即可。
It should not be that hard:
它不应该那么难:
FileReader frCSS = new FileReader("your_css.css");
FileReader frHTML = new FileReader("your_html.html");
FileWriter output = new FileWriter("result.html");
Then parse frHTML and copy its content to output until you find the head opening tag. When you do, open a style tag and copy all contents from frCSS. Then, close the style tag and copy the remaining portion of frHTML.
然后解析frHTML并将其内容复制到输出,直到找到head开头标记。执行此操作时,打开样式标记并从frCSS复制所有内容。然后,关闭样式标记并复制frHTML的剩余部分。
It's not pretty, but it can be done.
它不漂亮,但可以做到。
#1
You could just open the CSS file and just embed its content into a style tag.
您只需打开CSS文件,然后将其内容嵌入到样式标记中即可。
It should not be that hard:
它不应该那么难:
FileReader frCSS = new FileReader("your_css.css");
FileReader frHTML = new FileReader("your_html.html");
FileWriter output = new FileWriter("result.html");
Then parse frHTML and copy its content to output until you find the head opening tag. When you do, open a style tag and copy all contents from frCSS. Then, close the style tag and copy the remaining portion of frHTML.
然后解析frHTML并将其内容复制到输出,直到找到head开头标记。执行此操作时,打开样式标记并从frCSS复制所有内容。然后,关闭样式标记并复制frHTML的剩余部分。
It's not pretty, but it can be done.
它不漂亮,但可以做到。