Monday, June 29, 2009

CSS load order with Wicket and an external jar

I had a problem with the CSS from a provided jar (wicketstuff-jquery) overriding my local CSS. To get around this, I made sure the jar's CSS loaded first:

add(CSSPackageResource.getHeaderContribution(JQTabbedPanel.class, "jquery.tabs.css"));
add(CSSPackageResource.getHeaderContribution(MyWicketPage.class, "MyWicketPage.css"));

Wicket is clever enough to not load the same CSS twice. I knew which class and CSS file load by looking at the generated source:
<link rel="stylesheet" type="text/css" href="resources/org.wicketstuff.jquery.tabs.JQTabbedPanel/jquery.tabs.css" />

1 comment:

Roger said...

I have a similar problem with javascript - I'm using an implementation of your JGrowlBehavior and a WiQuery datepicker on the same page and they both add two different versions of jquery.js to the header which then breaks the JGrowlBehavior. Is there any standard wicket way to deal with this?