Hello,
I am currently looking into the topic of minimizing resources like JS, CSS
ahead of time and not before they are requested for the first time.
I already know that the resource minimizations are cached on a per-locale base
inside JavaScriptStackAssemblerImpl.
Unfortunately I can not find a way on how to minimize all resources before a
user first requests them.
My current approach would is to call a Tapestry page that loops over all
javascript resources and therefore triggers the minimization
Something like
@Inject
private JavaScriptStackSource javaScriptStackSource;
@Inject
private JavaScriptStackPathConstructor javaScriptStackPathConstructor;
/*
*****************************************************************************************************************
* Event Handlers
*/
public void minimizeJS()
{
for (String stackName : javaScriptStackSource.getStackNames())
{
javaScriptStackPathConstructor.constructPathsForJavaScriptStack(stackName);
}
}
But I do not really like this approach as it implies that somehow I have to
open this URL to make the minimization ahead of time - and even worse I would
need to do this on every machine in a clustered setup.
So basically I am looking for a way to minimize the resources together with
starting the server or even at build time if possible.
Thanks for hints and advices!
Stefan