Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 

Thymeleaf Jawr Extension

<dependency>
	<groupId>com.github.dtrunk90</groupId>
	<artifactId>thymeleaf-jawr-extension</artifactId>
	<version>2.0.3</version>
</dependency>

Attributes

All attributes need to be prefixed by jawr:.
To avoid IDE warnings you can add the namespace as follows:

<html xmlns:jawr="http://jawr.java.net" xmlns:th="http://www.thymeleaf.org"></html>

Javascript attributes:

Attribute name Type Purpose Default value
src String The bundle path.
useRandomParam Boolean The flag indicating if we must use random parameter in debug mode. true
async Boolean The async flag. false
defer Boolean The defer flag. false
type String The type attribute. text/javascript
crossorigin String The crossorigin attribute.

CSS attributes:

Attribute name Type Purpose Default value
href String The bundle path.
media String The media attribute of the stylesheet. screen
title String The title to use for the style.
useRandomParam Boolean The flag indicating if we must use random parameter in debug mode. true
alternate Boolean This flag is used to render link as an alternate style. false
displayAlternate Boolean This flag is used to render the skin variants of the CSS bundle as alternate style. false

Expression object #jawr

${#jawr.imagePath(String src)}						// base64 defaults to false
${#jawr.imagePath(String src, boolean base64)}

It's important to note that Jawr will generate the base64 encoded image for all browsers except IE6 and IE7, which doesn't handle base64 encoded images.

Usage examples

Javascript bundle:

<script type="text/javascript" src="jquery.min.js" jawr:src="/lib.js"></script>

CSS bundle:

<link rel="stylesheet/less" type="text/css" href="main.less" jawr:href="/all.css" />

Image:

<img src="../resources/img/dummy.png" alt="" th:src="${#jawr.imagePath('/resources/img/dummy.png')}" />

Image input:

<input type="image" src="../resources/img/dummy.png" th:src="${#jawr.imagePath('/resources/img/dummy.png')}" />

You can use expressions as well:

<script type="text/javascript" src="index.js" jawr:src="|/${pageName}.js|"></script>

About

Thymeleaf JAWR Extension

Resources

License

Packages

No packages published

Languages