in src/main/java/com/epam/digital/data/platform/notification/service/EmailNotificationLoader.java [83:99]
private void embedStyleToHtml(Document document, File dir) {
Elements link = document.select("link");
for (Element element : link) {
String styleName = element.attr("href");
if (styleName != null && !styleName.isEmpty()) {
var styleFile = Path.of(dir.getPath(), "css", styleName).toFile();
try {
document.head().select("link").remove();
document.head().select("style").remove();
var styleString = FileUtils.readFileToString(styleFile, StandardCharsets.UTF_8);
document.head().append("<style>" + styleString + "</style>");
} catch (Exception e) {
throw new NotificationBuildingException("Failed to embed styles into template", e);
}
}
}
}