net.optionfactory:rosemary

Extensions for Thymeleaf

License

License

Categories

Categories

Net
GroupId

GroupId

net.optionfactory
ArtifactId

ArtifactId

rosemary
Last Version

Last Version

1.1
Release Date

Release Date

Type

Type

jar
Description

Description

net.optionfactory:rosemary
Extensions for Thymeleaf
Project URL

Project URL

https://github.com/optionfactory/rosemary
Source Code Management

Source Code Management

https://github.com/optionfactory/rosemary

Download rosemary

How to add to project

<!-- https://jarcasting.com/artifacts/net.optionfactory/rosemary/ -->
<dependency>
    <groupId>net.optionfactory</groupId>
    <artifactId>rosemary</artifactId>
    <version>1.1</version>
</dependency>
// https://jarcasting.com/artifacts/net.optionfactory/rosemary/
implementation 'net.optionfactory:rosemary:1.1'
// https://jarcasting.com/artifacts/net.optionfactory/rosemary/
implementation ("net.optionfactory:rosemary:1.1")
'net.optionfactory:rosemary:jar:1.1'
<dependency org="net.optionfactory" name="rosemary" rev="1.1">
  <artifact name="rosemary" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.optionfactory', module='rosemary', version='1.1')
)
libraryDependencies += "net.optionfactory" % "rosemary" % "1.1"
[net.optionfactory/rosemary "1.1"]

Dependencies

compile (3)

Group / Artifact Type Version
org.thymeleaf : thymeleaf jar 3.0.11.RELEASE
org.slf4j : slf4j-api jar 1.7.26
com.fasterxml.jackson.core : jackson-databind Optional jar 2.11.0

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Rosemary, a collection of Thymeleaf extensions

Versioned Resources

This dialect offers an attribute to handle versioning of HTML resource (js, css) for cache busting purposes.

Configuration

Just add this dialect to the Thymelaf engine, passing the desired version as a constructor parameter.

final TemplateEngine engine = new TemplateEngine();
engine.setDialects(Arrays.asList(
    ...
    new VersionedResourceDialect(version),
    ...
));

Usage

Add a version:append attribute to any tag with a src/href attribute to append a version query parameter:

<script type="text/javascript" src="/path/to/resource.js" version:append></script>

will be rendered as

<script type="text/javascript" src="/path/to/resource.js?version=xxxx"></script>

Notes:

  • if a query string is already present the version parameter will be concatenated using &
  • an already present version parameter will not be overridden
  • empty src/href attributes will not be updated
net.optionfactory

OptionFactory

Versions

Version
1.1
1.0