public class ResourceBundleProcessor
extends org.thymeleaf.processor.element.AbstractElementProcessor
Takes a list of resources and optionally minifies (using the Yahoo YUI minifier) and combines them together to present a
single file in the response. This will also automatically version the file name when minifying so that changes to bundles
will not be cached by the browser. Most of the heavy lifting of this processor is done in ResourceBundlingService
which uses ResourceMinificationService.
The operation of this processor is dependent upon the bundle.enabled system property. If bundling is disabled
via this system property then each file is individually linked in the HTML source
For example, given this bundle:
<blc:bundle name="lib.js"
mapping-prefix="/js/"
files="plugins.js,
libs/jquery.MetaData.js,
libs/jquery.rating.pack.js,
libs/jquery.dotdotdot-1.5.1.js" />
With bundling enabled this will turn into:
<script type="text/javascript" src="/js/lib-123412.js" />
Where lib-123412.js is the result of minifying and combining all of the referenced files together.
With bundling disabled this turns into:
<script type="text/javascript" src="/js/plugins.js" />
<script type="text/javascript" src="/js/jquery.MetaData.js" />
<script type="text/javascript" src="/js/jquery.rating.pack.js.js" />
<script type="text/javascript" src="/js/jquery.dotdotdot-1.5.1.js" />
The files are presented without any additional processing done on them. This
This processor only supports files that end in .js and .css
ResourceBundlingService},
ResourceMinificationService}| Modifier and Type | Field and Description |
|---|---|
protected ResourceBundlingService |
bundlingService |
| Constructor and Description |
|---|
ResourceBundleProcessor() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
getBundleEnabled() |
protected org.thymeleaf.dom.Element |
getElement(String src) |
protected org.thymeleaf.dom.Element |
getLinkElement(String src) |
int |
getPrecedence() |
protected BroadleafResourceHttpRequestHandler |
getRequestHandler(String name,
org.thymeleaf.Arguments arguments) |
protected org.thymeleaf.dom.Element |
getScriptElement(String src) |
protected org.thymeleaf.processor.ProcessorResult |
processElement(org.thymeleaf.Arguments arguments,
org.thymeleaf.dom.Element element) |
doProcess, getMatcherprotected ResourceBundlingService bundlingService
protected boolean getBundleEnabled()
public int getPrecedence()
getPrecedence in class org.thymeleaf.processor.AbstractProcessorprotected org.thymeleaf.processor.ProcessorResult processElement(org.thymeleaf.Arguments arguments,
org.thymeleaf.dom.Element element)
processElement in class org.thymeleaf.processor.element.AbstractElementProcessorprotected org.thymeleaf.dom.Element getScriptElement(String src)
protected org.thymeleaf.dom.Element getLinkElement(String src)
protected org.thymeleaf.dom.Element getElement(String src)
protected BroadleafResourceHttpRequestHandler getRequestHandler(String name, org.thymeleaf.Arguments arguments)
Copyright © 2014. All Rights Reserved.