Socket
Socket
Sign inDemoInstall

org.jtwig:jtwig-hot-reloading-extension

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

org.jtwig:jtwig-hot-reloading-extension

Jtwig jtwig-hot-reloading-extension


Version published
Maintainers
1
Source

Jtwig Hot Reloading Extension

How to use?

  • Include the dependency in your project (check bintray).
  • Add to your custom Jtwig configuration
EnvironmentConfiguration configuration = EnvironmentConfigurationBuilder
    .configuration()
        .extensions()
            .add(new HotReloadingExtension(TimeUnit.SECONDS, 1))
        .and()
    .build();

How it works?

  • If the referenced resource is a file, it then checks for the last modified date and depending on such date, this may evict the cached template.

Integration with Spring Boot

Note that, jtwig-spring-boot-started module, by default, sets the template source as the classpath, bundling such application inside a standalone jar makes it impossible to edit such template files. For this to work, an easy solution can be to use templates stored in a specific directory, as shown in the example below:

@Configuration
public class JtwigConfig implements JtwigViewResolverConfigurer {
    @Override
    public void configure(JtwigViewResolver viewResolver) {
        viewResolver.setPrefix("file:/path/to/base/directory");
        viewResolver.setRenderer(new JtwigRenderer(EnvironmentConfigurationBuilder
                .configuration()
                .extensions().add(new HotReloadingExtension(TimeUnit.SECONDS, 1)).and()
                .build()));
    }
}

Build Stats

Build Status codecov Download

Licensing

Apache License

Requirements

  • Java 7

FAQs

Package last updated on 10 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc