5

While developing a website I experience a weird bug. From time to time my images or my css are missing.

It's not really predictable and therefore not reproducible.

Usually it happens after I edit my css, save it and reload the page (in the browser).

It's always syntactical correct CSS, so no compilation erros or anything similar.

I think it's the way Grails updates the running application, but I really can't say why or where it happens as it is quite rarely, but definitely annoying.

It doesn't matter if I run the application with my IDE (IntelliJ 9.0.4) or with the commandline (Windows).

The only thing I did not test so far is whether it happens only when I use the IDE or not.

Did anyone experience this?

EDIT: Sorry for an unclear description: "missing" means the browser is unable to load the corresponding ressource: "The Ressource () is not available"

Another Edit:

Thanks for the comments so far. In addition to my main css-file and my images, which change quite frequently, my reset-css-file disappeared. I never touched it since creation, so I think one can exclude the compilation-script as cause of this mess. (further info in the comments)

Zobbl
  • 469
  • 4
  • 18
  • probably a problem with your build script that runs during testing OR the debugger set up to run when debugging from the IDE. Try testing outside of the IDE. For local testing: make sure you are running this off your harddrive. You can try to disable parts of your build script(s) in your local version and see if that eliminates the problem. look at your build options.. – BumbleB2na Sep 15 '11 at 14:36
  • Well I'm just developing the website itself, just html, css and minor javascript.(the actual programming is done by a coworker) Since I don't need any special settings I'm using Grails at almost default settings. Just changed the application-context from "/project" to "/". So I'm not really debugging anything. Standard development procedure. – Zobbl Sep 15 '11 at 14:43
  • so if you made a temporary folder on your harddrive with only the files you are testing with, then it would still give you this images/css problem? – BumbleB2na Sep 15 '11 at 14:46
  • im not sure i understand you. do you mean i "extract" all the css, views and stuff to a new "clean" grails ? If not, im not quite sure how i would do that, since i need grails or rather sitemesh in grails to render the GSPs correctly because i use a lot of templating and decorating – Zobbl Sep 15 '11 at 14:50
  • i think Grails uses Gant to build your files whenever you run/compile/debug your Grails project. Maybe Gant is not always done building when your page decides it is time to begin loading. See if you can turn Gant off to some extent in your project options and maybe that will help. If Gant is not being used, is Ant being used or do your project options show anything regarding 'build' settings? – BumbleB2na Sep 15 '11 at 15:01
  • Do you get any errors in console output or in Grails log after saving CSS? If you disabled any logging, it might be a good idea to re-enable it for development. – Victor Sergienko Sep 15 '11 at 16:22
  • Well, no. Except for the error messages from firebug I don't get any errors. I still haven't tried disabling Gant (have to get my work done ;) ), but right now I edited my css-file, saved it, reloaded the page and now my reset-css-file (an additional file, never touched since creation) is missing. Therefore is the question if it getting compiled over and over again or just once - if only once i can almost exclude the compilation-script as a possible cause for my problem – Zobbl Sep 16 '11 at 12:18
  • This is happening to me.. any luck resolving this issue? After some time my htmls suddenly don't include css. My guess is the resources plugin cannot find them. But when I access the exact css path e.g. www.mvergel.com/static/css/main.css I can access it with no problem. I need to restart grails to fix this problem. I've already upgraded to 2.03 and latest plugins, still happening. – Manny May 24 '12 at 08:32

3 Answers3

2

Like John Smith I arrived here googling for this problem. But I found another solution, and i hope that it helps you too.

I googled a little bit more and found this discussion Disabling static resource stuff, here i found a contributor of grails application, and author of Resources Plugin, Mark Palmer (take a look his website), telling what he is doing and answering the questions about this plugin.

Today, all you need to do is to update the Resources Plugin to version 1.2-RC1 or a recent one that will fix this problem.

Community
  • 1
  • 1
leomeurer
  • 742
  • 1
  • 8
  • 24
0

Really old question.. but for anybody googling this - I had similar issues with my CSS because of Windows file format on the Linux systems. Once I changed the format to unix, I still had to restart the server for the css to download. Note that somehow the css were downloading earlier although the format was windows and the issue was intermittent.

0

When you say missing, do you mean that the changes are missing, or the whole stylesheet is missing? If it is just your latest changes, it is possible that your browser is caching the previous css file and isn't getting the latest changes. Try doing a "hard refresh" with something like CTRL+F5, or whatever hard refresh is in the browser that you are using. This will force a pull of the latest resources.

skaz
  • 21,962
  • 20
  • 69
  • 98
  • Missing means the browser doesn't load the css / the images. It's not the browser cache, because I did test it with every browser I have access to. If I open firebug and look for the CSS I get the Grails-errormessage "The Resource() ist not available". – Zobbl Sep 15 '11 at 14:37