這個問題最好用一個例子來描述。GWT:如何從同一個ClientBundle在另一個樣式表中定義的一個樣式表常量中訪問
我在我的GWT應用中的以下ClientBundle:
interface Resources extends ClientBundle {
public static final Resources INSTANCE = GWT.create(Resources.class);
@Source("defines.css")
Defines defines();
@Source("appStyle.css")
@CssResource.NotStrict
Style style();
interface Style extends CssResource {
String appLogo();
(...)
}
interface Defines extends CssResource {
String formInputBackgroundColor();
String formInputBorderColor();
(...)
}
}
的appStyle.css
是由應用程序使用的主要樣式表和defines.css
是包含只喜歡常量樣式表:
@def formInputBackgroundColor #D8ECFD;
@def formInputBorderColor #7FAAFF;
(...)
現在我可以使用UIBinder模板中的defines.css
樣式表中的常量和應用程序代碼沒有問題,但我不能在我的appStyle.css
中使用這些常量。
我已經嘗試與interface Style extends Defines
更換interface Style extends CssResource
,希望從Defines
樣式繼承會給我訪問的常量「子」 Style
樣式,但隨後的GWT編譯器一樣的錯誤抱怨:
Rebinding my.project.client.resources.Resources
Creating assignment for style()
Replacing CSS class names
The following obfuscated style classes were missing from the source CSS file:
formInputBorderColor: Fix by adding .formInputBorderColor{}
formInputBackgroundColor: Fix by adding .formInputBackgroundColor{}
(...)
有什麼辦法可以做到這一點?