suggestion: jawr integration

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

suggestion: jawr integration

Ivica Loncar
It is possible to use thymeleaf template as sitemesh decorator.

It would be nice if thymeleaf could bundle javascript libraries and css, or compress them, like jawr does.
Consider adding custom processor that would integrate jawr.
Reply | Threaded
Open this post in threaded view
|

Re: suggestion: jawr integration

FingolfinTEK
If anyone needs it, the code for jawr integration can be found here: http://code.google.com/p/thymeleaf-jawr-extension/source/browse/
Fingolfin like a shooting light
beneath a cloud, a stab of white,
sprang then aside, and Ringil drew
like ice that gleameth cold and blue,
his sword devised of elvish skill
to pierce the flesh with deadly chill.
Reply | Threaded
Open this post in threaded view
|

Re: suggestion: jawr integration

dostermeier
In reply to this post by Ivica Loncar
There is a discussion on thymeleaf + sitemesh in another post: http://forum.thymeleaf.org/Themes-in-Thymeleaf-td3216297.html

I recommend taking a look because Craig has done some excellent work on it.
Reply | Threaded
Open this post in threaded view
|

Re: suggestion: jawr integration

Zemi
Administrator
In reply to this post by FingolfinTEK
Hi FingolfinTEK!

Great news! I'll try jawr with your dialect.

Could you consider changing the code licence to a LGPL, BSD, Apache, MIT...(compatible with commercial apps)?

Reply | Threaded
Open this post in threaded view
|

Re: suggestion: jawr integration

FingolfinTEK
Changed to LGPL :)

Btw, I forgot to mention, the syntax for using jawr is a bit different than it was with JSP taglib: I've decided to stay true to Thymleaf's "it's still a prototype" strategy so for importing a JS bundle, you should use the jawr:script attribute of a script tag (instead of a jawr:script tag which the JSP taglib used):

<script jawr:script="/javascript/jquery-1.6.1.js" src="/javascript/jquery-1.6.1.js"></script>

It's similar for CSS - just use jawr:style attribute of a link tag:

<link jawr:style="/css/styles-all.css" />

To use it in a Spring MVC environment, just modify the template engine bean definition like this:

<bean id="templateEngine" class="org.thymeleaf.spring3.SpringTemplateEngine">
	<property name="templateResolver" ref="templateResolver" />
	<property name="dialects">
		<set>
			<bean class="org.thymeleaf.spring3.dialect.SpringStandardDialect" />
			<bean class="com.google.code.thymeleaf.jawr.JawrDialect" />
		</set>
	</property>
</bean>
Fingolfin like a shooting light
beneath a cloud, a stab of white,
sprang then aside, and Ringil drew
like ice that gleameth cold and blue,
his sword devised of elvish skill
to pierce the flesh with deadly chill.
Reply | Threaded
Open this post in threaded view
|

Re: suggestion: jawr integration

danielfernandez
Administrator

FingolfinTEK, this looks really interesting. Thank you very much for sharing it.

I'd love to give some visibility to your dialect, I'm sending you an email.

Regards,
Daniel.