1) @external rule can be used if you want to have both programmatic
access as well as access by class name in your app.

For ex: Consider this UIBinder fragment.

<HTMLPanel stylename={ css.someStyle}>
<div class=".someStyle'></div>
</HTMLPanel>

Where someStyle is defined in CSS resource
When you compile this, someStyle is obfuscated in to say something
like 'GABEFS1F'.  In this case innerdiv <div> wont be able to find
".someStyle' , cos its been obfuscated.
In order to avoid this,@external rule is used.

It comes  handy when you try to port some legacy app, where css class
names are already hardcoded in to HTML pages.

2) Assume that you have legacy app with hundreds of styles. Now you
started porting some widgets to GWT. And you realize that you dont
want programmatic access to all the styles. But GWT will throw you
error , if you dont define String accessor methods for all
styles(hundreds). Thats where @NotStrict rule comes in to picture,
telling GWT not to worry about Styles which dont have accessor
methods.

Note: Its not necessary that styles to be defined only in separate CSS
file. With UiBinder, you can define styles local to your widget and
not worry abt name collision ( Obfuscation of style names will take
care of this)

Hope this helps.

-prakash m.

















2011/10/21 Mike Dee <[email protected]>:
> #1
> At:
> http://code.google.com/webtoolkit/doc/latest/DevGuideClientBundle.html#CssResourceCookbook
>
> It says:
> External and legacy scopes
> In many cases, newly-developed CSS will need to be combined with
> external or legacy CSS. The @external at-rule can be used to suppress
> selector obfuscation while still allowing programmatic access to the
> selector name.
>
> Question: Why would anyone ever want obfuscation on?  If I have a CSS
> selector ".myheader" wouldn't I always want to refer to it as:
> MyResources.INSTANCE.css().myheader()?
>
> #2
> At:
> http://code.google.com/webtoolkit/doc/latest/DevGuideClientBundle.html#Selector_obfuscation_details
>
> It says:
> Strict scoping
> In the normal case, any class selectors that do not match String
> accessor functions is an error. This behavior can be disabled by
> adding a @NotStrict annotation to the CSS accessor method. Enabling
> @NotStrict behavior is only recommended for applications that are
> transitioning from external CSS files to CssResource.
>
> Even with CssResource isn't all the CSS stored in a separate CSS file?
>
> So far, CSS with GWT is a mystery to me.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to