On Fri, Nov 20, 2009 at 1:53 AM, Ray Ryan wrote:
> Just to be clear:
> In the case at hand, where the shared CSS file has nothing in it but @def
> values, there is nothing to be gained by an approach that is any more
> complicated than:
>
> <ui:style src='colors.css'>
> .foo { color: yellow; }
> </ui:style>
This works (using RC2); I cannot use an absolute path though (my
*.ui.xml and *.css files are in different packages). This works:
<ui:style src="../../../core/client/resources/style.css">...</ui:style>
but neither of these do (both produce an "Unable to find resource" error):
<ui:style src="/com/myApp/core/client/resources/style.css">...</ui:style>
<ui:style src="com/myApp/core/client/resources/style.css">...</ui:style>
The first one (src="/com/...") searches for
"com/myApp/moduleA/client/ui//com/myApp/core/client/resources/style.css"
(notice the double-slash); maybe a src="" starting with a slash could
be special-cased to be treated as an absolute path? (rather than
relative to the package containing the *.ui.xml file)
Would you like me to file an issue for this?
> But if you want to share actual class definitions, the @Shared mixin is the
> way to go.
But then the @Shared CssResource's methods must only reference class
names, not constants, or you'll have a "The following obfuscated style
classes were missing from the source CSS file: [ERROR] red: Fix by
adding .red{}" error (my style.css contains a "@def red green;" and
the @Shared interface has a "String red()" method)
Thanks at lot anyway, I can now refactor my resources to have a
constants.css that can be referenced using src="" on <ui:style> in my
*.ui.xml files, and a @Shared CssResource with common CSS classes
(with the @Source referencing both common.css and constants.css to
import my @def's).
I'll get back to you if I ever have a problem in doing so ;-)
--
Thomas Broyer
/tɔ.ma.bʁwa.je/