I'm working on a Java site (jQuery, Wicket, Maven, Spring, Hibernate) and we have just started using a CDN to serve static files on our production server. We use a placeholder for the CDN domain, and have added it to every static file that references a static file. The placeholder gets replaced by Maven through properties filters with Maven.
So, for every static file served by the CDN, we have something like this:
<img src="${placeholder}/images/dogs/rex.jpg"/>
For production, ${placeholder} is replaced with "http://cdn.com" and for development environments, it is replaced with blank.
...Is there a better way? It seems unusual to globally add a Maven-specific placeholder to the static files themselves. It will need to be added for every new image going forward, as well. In addition, changes to static files MUST go through a Maven build before those changes will show in a browser, and this slows down development in certain environments. This is probably avoidable, but still seems unnecessary in the first place.