diff --git a/src/main/java/tech/jhipster/lite/generator/server/springboot/thymeleaf/template/domain/ThymeleafTemplateModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/server/springboot/thymeleaf/template/domain/ThymeleafTemplateModuleFactory.java index be5f3a0ef28..ceea9a5e737 100644 --- a/src/main/java/tech/jhipster/lite/generator/server/springboot/thymeleaf/template/domain/ThymeleafTemplateModuleFactory.java +++ b/src/main/java/tech/jhipster/lite/generator/server/springboot/thymeleaf/template/domain/ThymeleafTemplateModuleFactory.java @@ -20,6 +20,8 @@ public class ThymeleafTemplateModuleFactory { private static final JHipsterProjectFilePath MAIN_RESOURCES_PATH = path("src/main/resources"); private static final JHipsterDestination DESTINATION = to(MAIN_RESOURCES_PATH.get()); + private static final String MAIN_SCRIPT_NEEDLE = ""; + public JHipsterModule buildModule(JHipsterModuleProperties properties) { Assert.notNull(PROPERTIES, properties); @@ -41,7 +43,7 @@ public JHipsterModule buildHtmxWebjarsModule(JHipsterModuleProperties properties return moduleBuilder(properties) .mandatoryReplacements() .in(MAIN_RESOURCES_PATH.append(TEMPLATES_LAYOUT).append(MAIN_HTML)) - .add(lineBeforeText(""), "") + .add(lineBeforeText(MAIN_SCRIPT_NEEDLE), webjarsScriptTag("htmx.org/dist/htmx.min.js")) .and() .and() .build(); @@ -55,10 +57,14 @@ public JHipsterModule buildAlpineWebjarsModule(JHipsterModuleProperties properti return moduleBuilder(properties) .mandatoryReplacements() .in(MAIN_RESOURCES_PATH.append(TEMPLATES_LAYOUT).append(MAIN_HTML)) - .add(lineBeforeText(""), "") + .add(lineBeforeText(MAIN_SCRIPT_NEEDLE), webjarsScriptTag("alpinejs/dist/cdn.js")) .and() .and() .build(); //@formatter:on } + + private String webjarsScriptTag(String webjarsLocation) { + return "".formatted(webjarsLocation); + } }