css images

Jul 10, 2009 at 4:45 PM

I Love this tool.  Very useful!

One problem I've encountered is in regards to url( [image] ) declarations in css (e.g., "background-image: url( images/myimage.png )" ).  The relative paths to images within the css file become mangled with the new url created by the resource combiner, resulting in images not being found at runtime.  Is there any way around this, short of manually changing the relative paths within the css file?

Aug 21, 2009 at 7:53 PM

I've included a textparser so you are able to use variables that will be replaced at runtime. for example you could prepend ~/ to all your img paths with will be replaced to the applications virtual directory path on the server

ps. its always a good idea to use absolute instead of relative paths!

Aug 21, 2009 at 9:18 PM

Sounds interesting.  Where is this text parser you speak of?

I'm not sure I agree with your statement about using absolute vs. relative paths.  Do you mean this in specific reference to your text parser tool?  I am using a JQuery UI css skin and thus I do not have control over the paths (short of changing the css file myself -- but the file becomes obsolete if I upgrade to the latest version of the skin).  What is the reasoning behind this statement? -- just curious....

Aug 21, 2009 at 10:05 PM

I have published my version of the Client Resources Combiner here http://cssandjscombiner.codeplex.com/ - instead of having MVC HtmlHelpers i've included two WebControls to aid in including and managing Client Resources on the webpage, plus the resources are served via a IHttpHandler. It should be fairly easy though to make it MVC friendly.

About the statement about relative url's its always a headache not to use absolute paths when it comes to moving your files around. Of course, if you are depending on a 3rd party library it makes things more interesting, but even with a 3rd party product it should let you be able to provide absolute paths to files and locations. Just my 2 cents! :)

Oct 29, 2009 at 5:50 PM
Edited Oct 30, 2009 at 7:58 AM

@Codebender: I'll take a look at this and update you.  I'm glad you like the library.  Sorry it takes long to provide feedback, I didn't get noticed by CodePlex about the discussion board's activity.

 

Oct 31, 2009 at 8:27 AM

This is fixed with the latest development code (Combres 1.0 Beta).  Get the code from the Source Code tab, or wait until I make a release (within a day or two from now).

Nov 2, 2009 at 6:27 PM

Awesome!  I will give it a try.

Nov 3, 2009 at 5:30 AM

@codebender: the binary release is available here: http://combres.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=35200.  Also, check out this tutorial I wrote about the library to understand the CSS URL filter implemented in this release (which addressed the problem you reported): http://www.codeproject.com/KB/aspnet/combres.aspx.