*
* @param file
*/
private synchronized XML rebuild(Path file) {
long now = new Date().getTime();
XML html = I.xml(file);
// append live coding script
html.find("script[src=\"application.js\"]").after(I
.xml("script")
.attr("type", "text/javascript")
.attr("src", "live.js"));
// ignore cache
for (XML link : html.find("link[rel=stylesheet]")) {
String href = link.attr("href");
if (href.length() != 0 && !href.startsWith("http://") && !href.startsWith("htttps://")) {
link.attr("href", href + "?" + now);
}
}
for (XML link : html.find("script[src]")) {
String src = link.attr("src");
if (src.length() != 0 && !src.startsWith("http://") && !src.startsWith("htttps://")) {
link.attr("src", src + "?" + now);
}