The best fix would be to use @Import instead of @Shared+inheritance (you don't even use the fact that MyCss extends GlobalCss). In other words, your InitButton is OK, not MyCss.
On Sunday, February 23, 2014 10:13:00 PM UTC+1, GWTter wrote: > > Hi Thomas, > > I think this part right here is the clarification I needed: > > > - mapping class names to/from methods is based on the method name or a > @ClassName annotation (the class name in the CSS file will thus be > replaced > with the unique name computed for the method) > > So, if you want to reuse a class name in a selector, then use @Import or > @Shared+inheritance. The difference is that with @Shared you're forced to > declare rules for the inherited/shared class names (to satisfy the 4th rule > above), and the class name is accessible from outside the CSS file, from > the CssResource interface (because of inheritance). > > I'd like to think I wasn't misunderstanding anything as I can't find > anywhere in the doc where it says if you use @Shared with inheritance then > you have to declare all the super cssresource selectors in the extending > cssresource's css. It was for this reason that I was adding the extended > CssResource's css to the source declaration of the extending cssresource. I > thought that redeclaring the super's selectors (as empty rules of course) > in the extending css again to avoid the GWT errors felt like a hack > especially if you consider that any time you add a new class to the super > css you would have to redeclare the same class in all extending css. This > didn't feel as going in the direction of maintainability which is why I was > redeclaring the css in the @source (even though the leads to duplicate > rules being inserted). But as I see that this is the state of things > currently I'd gladly redeclare the selectors as empty ones in all the > extending css as seeing the error to fix is much better than inserting a > whole bunch of duplicate css. > > For reference, with this in mind, the example I gave Jens above would need > the following changes to work correctly without duplication or the > precedence override issue: > My.css would contain: > .genButton,.genButtonOther{} /*redeclare super selectors as empty to avoid > GWT error*/ > > .myButton{ > background: red; > } > > And the MyCss declaration in MyClientBundle would be changed simply to: > @Source("My.css") > MyCss myCss(); > > > This is what you're referring to right? And thanks again for the detailed > explanation, this will be extremely useful as a reference and complement to > the doc. > > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.