From a6537a1349de14f9fb457d7abb14147c7a0795b2 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 26 Sep 2018 23:03:59 +0300 Subject: live reload for templates --- .../java/com/juick/server/configuration/WwwAppConfiguration.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'juick-server/src/main') diff --git a/juick-server/src/main/java/com/juick/server/configuration/WwwAppConfiguration.java b/juick-server/src/main/java/com/juick/server/configuration/WwwAppConfiguration.java index f829a999..9f68032d 100644 --- a/juick-server/src/main/java/com/juick/server/configuration/WwwAppConfiguration.java +++ b/juick-server/src/main/java/com/juick/server/configuration/WwwAppConfiguration.java @@ -93,8 +93,16 @@ public class WwwAppConfiguration implements WebMvcConfigurer { @Bean public PebbleEngine pebbleEngine() { + boolean devToolsArePresent = false; + try { + Class.forName("org.springframework.boot.devtools.livereload.Connection"); + devToolsArePresent = true; + } catch (ClassNotFoundException e) { + // release mode + } return new PebbleEngine.Builder() .loader(this.templateLoader()) + .cacheActive(!devToolsArePresent) .extension(springExtension()) .extension(new FormatterExtension()) .strictVariables(true) -- cgit v1.2.3