Do you "mvn process-resources" when you change something in src/main/resources?
On Wednesday, October 5, 2016 at 2:12:07 PM UTC+2, N Troncoso wrote:
-- On Wednesday, October 5, 2016 at 2:12:07 PM UTC+2, N Troncoso wrote:
I'm starting a new project using GWT 2.8-rc2, and am setting up my GSS resources. It all works and the pages render correctly, but if I change a GSS file, the changes aren't loading when I refresh the browser.I have my ResourceBundles in src/main/java/com/company/project/client/resources And I have my gss files in src/main/resources/com/company/project/client/ resources/gss So, when setting up my ResourceBundle, I do @Source("gss/style.gss")Just in case this is relevant, here are the properties in my gwt.xml file for GSS:
<set-configuration-property name="CssResource.enableGss" value="true" /><set-configuration-property name="CssResource.conversionMode" value="strict" />This works, but like I said, if I make a change in style.gss, the change is not loaded when refreshing the browser. I have to stop the codeserver and restart itI don't think this matters, but the way I set up my resources is to have a CssResource per gss file. Then, I have a singleton Resource.java class. In it, I have a single ClientBundle that hooks each CssResource to its gss file. Then, I create static methods for each Resource. It looks like this:
public class Resources{public static interface ResourceBundle extends ClientBundle{@Source("gss/flex.gss")FlexStyleResource flex();@Source("gss/colors.gss")ColorResource col();@Source("gss/fonts.gss")FontResource font();@Source("gss/widgets.gss")WidgetResource widget();}private static Resources INSTANCE;public synchronized static Resources get(){if (INSTANCE == null){INSTANCE = new Resources();}return INSTANCE;}public static FlexStyleResource flex(){return get().resources.flex();}public static ColorResource col(){return get().resources.col();}public static FontResource font(){return get().resources.font();}public static WidgetResource widget(){return get().resources.widget();}private final ResourceBundle resources;public Resources(){resources = GWT.create(ResourceBundle.class); }public void init(){resources.flex().ensureInjected(); resources.col().ensureInjected(); resources.widget().ensureInjected(); resources.font().ensureInjected(); }}
And so, when I need something, I can do Resources.col().primaryColor()for example. Note: I call init() in my EntryPoint.onModuleLoad() Thanks in advance for any advice
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment