CSS is not refreshed after change - css

Here is my simple (I hope) problem:
I 'm running a web app with eclipse through tomcat 7. I use the classic servlet-model-jsp pattern. My problem is when I change something in the stylesheet (CSS) and restart tomcat and reload the page on the chrome, the new css is not loaded on the browser (I check it through the browser and i see the same as before the changes).
What is wrong and what can i do about it?!
Thank you in advance :)

I don't think this is a client issue. I think it is a bug in Eclipse/ Tomcat plugin. If you check the request.getPathTranslated() inside the servelet doGet method, it will be something like
C:\Users\YourName\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\
wtpwebapps\yourAppName\
So the tomcat running inside eclipse is serving up static content from there, which is different to the location of static content that you are editing, which is usually something like
C:\fullPathTo\yourAppName\src\main\webapp\static
Tomcat inside eclipse often neglects to update the static content from where you have edited it to the plugins... spot from where it serves it to your web page.
To solve the problem I use Beyond Compare or similar, and set up a compare between the directories
C:\fullPathTo\yourAppName\src\main\webapp\static
and
...\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\yourAppName\static
If css or other static changes (such as javascript files) fail to show up in the browser, just do a quick refresh of the Beyond Compare window, this will highlight the mismatches, copy them across manually, and you are good to go.
I know this is a hack but it works for me, till the eclipse guys get this sorted out.

Related

Vaadin Valo Stylesheets

I'm having a problem using Vaadin (in Eclipse) and its associated styling engine Valo, and the TouchKit package. I mention all of these because I'm not sure which, if any, is causing the problem. The name of my custom theme (which imports Valo) is simply "touchkit".
I have the project running on a Tomcat server on localhost and accessible in my browser. I wanted to tweak some of the CSS so I edited the appropriate file WebContent/VAADIN/themes/touchkit/touchkit.scss. After editing this file, I recompile the theme and see the appropriate changes in the generated file styles.css. Then I go to load up the application in my browser, and things get weird.
I can load the page and, using Chrome's developer tools, see that the page requests styles.css for download, as expected. It gets a 200 OK response from the server, but when I view styles.css, it contains just a single \n. This is also true in Safari. Even using cURL to download styles.css yields the same result. In the Eclipse editor, and when I inspect it in the terminal, styles.css is ~12,000 lines long. Why can't my browser or cURL get that data?
I can view similar project demos on Vaadin's own site and the stylesheet (which should be almost identical to mine) is loaded correctly. Also, other Vaadin projects on my localhost server have their stylesheets loaded correctly (though they do not use Valo). Compiling the theme in Eclipse yields no errors. Because the issue presents itself across a variety of graphical and non-graphical clients, I'm starting to think the issue is with Tomcat. But I can get to the directory from which Tomcat serves files and styles.css is correct in that folder too. There's no apparent reason that Tomcat would be serving a blank file.
You may have guessed from the description, but I'm working on a Mac. Any help is appreciated!
PS Mods - I also asked this question over at Superuser since it wasn't 100% a programming question. However, I'm new at Superuser and couldn't create tags for Vaadin or Valo, so I'm asking here where there might be a better chance of getting an answer.
Hard to say, since your are doing everything fine. My best bet would be the tomcat implementation you are using, maybe there's something weird there. Try upgrading to latest if it's not or to a previous version.
FYI I'm using Tomcat 7.0.55.
PS: your attempts are in run/debug from eclipse or have you made a .war form the project and deployed it with the Tomcat-Manager?
Regards
add below to your gwt.xml, and touchkit is not valo aware see https://vaadin.com/forum/#!/thread/8264224/8264223
<set-configuration-property
name='touchkit.manifestlinker.additionalCacheRoot'
value='src/main/webapp/VAADIN/themes/MyTheme:../../../VAADIN/themes/MyTheme' />

When I try to use grunt serve to view a locally stored web app, the CSS doesn't work. What are the common causes for this?

I think I have installed everything needed and installed it correctly, but I am obviously missing something; or had a misstep somwhere along the line. I am on a Linux and I know for a fact the site works when viewed elsewhere. Here is a screenshot of what I see when I view the site locally: http://imgur.com/yPWcanu What are the common causes for this?
There might be some problems with paths. Open the Chrome development toolbar and check if there's a problem with loading the css files.
You should see them under the "Network" tab after reloading the page.

Is moving a CSS file between .NET servers difficult?

Here's the rundown:
- We have a web site built with a commercial CMS (Sitefinity)
- The web site is .NET
- We have a test server and the live server set up for development (HTML, CSS, JavaScript).
I'm not a .NET programmer, but I work on a lot of frontend work. My question is this:
When I make CSS changes on the test server, is it normal practice for the entire web site to be "pushed" over to the live server? In other words, can I not just move over the CSS file from development to the live server? (It does not work when I do this.)
I ask this because every time CSS changes are made, the entire web site has to shutdown for 10-20 minutes to "push" the entire development to the live server. This seems like an unusual practice for something so small as making a few CSS changes, and it heavily slows down my work. Shutting down an entire web site to publish one basic CSS file just seems unreasonable of a service.
Can someone please educate me about your processes for .NET and CSS changes? What are the best practices in the industry? I would like to better my understanding of this.
Thank you. Your insight is appreciated.
We use Sitefinty as well and you can just copy or FTP the CSS file or files instead of redeploying the entire site. I like to use Beyond Compare.
We have some ways to push the changes on our development server to live server using sitefinity:
We can choose synchronization option in sitefinty, using that we can push content and all from one server to other server.
http://www.sitefinity.com/documentation/gettingstarted/getting-started-synchronizing-data-between-two-servers
You are doing updation on css files only then need not to push all code every time, might be after doing changes you are not able to see reflection, in that case please publish the page once and you can see reflection.
Please let me know if you want to know more.
It's possible there is some sort of caching going on. perhaps you can check the settings for static content with your host or in IIS to see when static files like css expire.
In addition you can restart Sitefinity by going to Administration Settings > Basic > Languages and clicking Save (or installing the Falafel Dashboard which has a handy restart button you can put on the home page)
Restarting the site should clear the cache and show you the changes. I hope this is helpful!

newbie question about css property set up in Web developer 2010 Express

I am relatively new in C# and ASP.NET MVC.
There is something unusual that happens and it could be a simple property setup...
I have a MVC Web app and a css file associated with it in my Content folder.
Now everytime I do some changes in the css file I don't see these changes when I run the app. It seems that whatever I do the app keeps on using the old file. I can see it when I do a View Source on the page.
I played a bit with the Copy to Output Directory property in Web Developer without any good results.
Am I really missing something here ?
Thanks
Either restart casini, the web server for asp.net, the icon down by the clock or try hitting F5 in the browser a bunch of times.
Try clearing the cache in your browser.

Using HttpModule to Display Images

I have an HttpModule that displays images that follow a certain URL pattern. For example, /images/employees/jason.jpg is handled by the module, but all other images aren't. It works just fine on my local machine (Cassini and IIS 7). However, the IIS6 production server isn't working. I've had the hosting company map the images to the ASP.NET worker process. Now, all images are showing that they can't render except for the images that should be rendered by the module. They are working correct.
I ran an HttpWatch instance on one of the files and received the following error:
ERROR_HTTP_INVALID_SERVER_RESPONSE
Any ideas?
Final Answer:
The module needed to be updated to transmit server files. So, I added an else to my original if and checked to see if it was an image type (by using a utility method) then use Response.TransmitFile() to pass on the file to the browser.
I then ran into a spacing issue with the images. This was because I forgot that I had .aspx files registered as an image type to perform the testing. So each page would crash during the debug process or add padding that was established from CSS. Doh!
Everything is just peachy now. Thanks to all!
There's doesn't seem to be anything particularly wrong with your module, so the issue must be coming from somewhere else. Have you got security that might be blocking the images? What actually gets returned when you request a static file?
I'd suggest seeing what gets returned (and its headers) using something like firebug to check things like the response code, content type, the actual raw response, etc...
check your web.config IIS6 / IIS7 have different places to add modules and depends on what mode your IIS7 is running in.
http://arcware.net/use-a-single-web-config-for-iis6-and-iis7

Resources