Felipe
Felipe

Reputation: 33

How to change, override or cut off Tapestry default style?

I'm trying to use beaneditform in Tapestry 5.3 and I would like to know how to don't use the forms default css styles.

I would like to use my css styles from my layout component.

I tryed to override it but I think it would generate overhead in my application.

Best regards

Upvotes: 2

Views: 1277

Answers (2)

nkvnkv
nkvnkv

Reputation: 954

in appmodule.java do the folowing for Tapestry versions 5.3 and Tapestry 5.5.

public static void contributeApplicationDefaults(MappedConfiguration<String, String> configuration) {
...
 // myStyles.css will now be the default css provided by Tapestry
 configuration.add(SymbolConstants.DEFAULT_STYLESHEET, "context:css/myStyles.css");
....
}

For Tapestry 5.4, you can remove all of its CSS with this.

@Core
@Contribute(MarkupRenderer.class)
public static void deactiveTapestryClientCode(OrderedConfiguration<MarkupRendererFilter> configuration) {
        configuration.override("InjectDefaultStylesheet", null);
}

Upvotes: 0

Howard M. Lewis Ship
Howard M. Lewis Ship

Reputation: 2337

Order matters in CSS; what you need to do is ensure that your CSS is added after the default Tapestry CSS. In you layout component:

@Import(stylesheet="context:css/mysite.css")
void afterRender() { }

This means that the import of the stylesheet happens during the AfterRender phase, which occurs at the end, after Tapestry has added its own stylesheets.

Alternately, you can use Tapestry symbols to override the path to the Tapestry default stylesheet.

Upvotes: 4

Related Questions