if change css, need restart the server?

2,198 views
Skip to first unread message

tong123123

unread,
Dec 21, 2012, 4:30:15 AM12/21/12
to google-we...@googlegroups.com
my css is placed in structure like
public
   my.css
client
   xxx.java
shared
  xyz.java
server
  zzz.java

I try to modify the css and then close the development mode and restart it, but the css effect is still not seen. Everytime I change css, I need restart server, is this a easier way to modify css and see the effect without restart the server?

RyanZA

unread,
Dec 21, 2012, 9:14:50 AM12/21/12
to google-we...@googlegroups.com
It could be something with your setup.

Using normal GWT dev mode with firefox, I can change my compiled GWT .css (css resource), hit F5 in the browser, and I see the css changes right away. If you are using css in your WAR folder, your browser may be caching it. Try hit shift+f5

Steve

unread,
Dec 21, 2012, 10:08:01 AM12/21/12
to google-we...@googlegroups.com
I've been experiencing a similar problem in both FF and Chrome.

The problem has always been there with Chrome, but FF started a month or two ago.

In FF I've got the "Web Developer Toolbar" extension installed. Right click on webpage, goto the web developer menu, CSS menu, then "reload CSS".

It'll reload straight from your updated files. No need to even hit F5.

HTH

Steve

Joshua Godi

unread,
Dec 21, 2012, 12:22:12 PM12/21/12
to google-we...@googlegroups.com
Sometimes two refreshes will pick up CSS changes for me. But a word of advice, convert your CSS to use ClientBundle, that way it GWT will make it available on compile, so just a simple refresh will fix it.

There are many tutorials on how to use ClientBundle properly.

tong123123

unread,
Dec 23, 2012, 10:27:46 PM12/23/12
to google-we...@googlegroups.com
no luck in refresh twice, maybe really need to change to CssResource or ClientBundle.
I am using maven, my css placed under public folder as the first post mention, change css in that place will not be reflected in development mode, still need restart server everytime, very trouble.

tong123123

unread,
Dec 24, 2012, 1:50:08 AM12/24/12
to google-we...@googlegroups.com
For more information, we found if using jetty server and development, changing css will reflect in browser in development mode, if using externaml sever, then even using development, changing css will not cause browse UI change.

I have a look about cssResources at
https://developers.google.com/web-toolkit/doc/latest/DevGuideClientBundle#CssResourceCookbook
but feel very complicated, any simpler tutorial to teach about using it?

in its documentation,

Obfuscated CSS class names

CssResource will use method names as CSS class names to obfuscate at runtime.

interface MyCss extends CssResource {
 
String className();
}

interface MyResources extends ClientBundle {
 
@Source("my.css")
 
MyCss css();
}

All instances of a selector with .className will be replaced with an obfuscated symbol when the CSS is compiled. To use the obfuscated name:

MyResources resources = GWT.create(MyResources.class);
Label l = new Label("Some text");
l.addStyleName(resources.css().className());
in a normal css file, there should be many class name, so how to insert the classname in addStyleName()?



RyanZA

unread,
Dec 24, 2012, 1:58:15 AM12/24/12
to google-we...@googlegroups.com
Documentation is really bad for CSS resource - don't think there is even any CSS code in the documentation itself...

Css file my.css would be placed in the same folder as 'MyResources.java' file

If my.css looks like the following:

.className {
 width:100px;
}

.something {
 width: 200px;
}

then MyCss interface must look like this:

interface MyCss extends CssResource {
 
String className();

String something();
}

Now in your actual code, where you have addStyleName("something") before, it must now be addStyleName(resources.css().something())

GWT will now create the minimum css for that style and inject it in.

Dániel Hári

unread,
Jun 12, 2016, 8:56:10 AM6/12/16
to GWT Users
The problem is that in dev mode the src webapp folder copied to target only at startup, and DevMode does not refresh it. As a workaround you can use copy-resources, that take care of applying changes on the fly.
Reply all
Reply to author
Forward
0 new messages