I\'d like to define some colours as constants in a GWT CssResource, and use those constants throughout my application; but I don\'t know how to do that.
I\'ll tell you w
This is how we do it:
constant.css
file@def black #241b15; /* text color */
@def orange #ff4f00; /* links */
.myStyle {
color: orange;
}
Hope that helps.
EDIT:
To avoid the relative path in the
element you could do the following:
constants.css
)@def junglegreen #1f3d0a;
ClientBundle
and CssResource
to retrieve the defined constantspublic interface MyResources extends ClientBundle {
public static final MyResources INSTANCE = GWT.create(MyResources.class);
public interface Constants extends CssResource {
String junglegreen();
}
Constants constants();
}
-use the @eval
annotation to access the constant
@eval green com.gwt.client.widget.test.MyResources.INSTANCE.constants().junglegreen();
.someClass {
color: green;
}
The only way I know of how to deal with constants without referencing the css file itself.