alexo / wro4j

New project location is:https://github.com/wro4j/wro4j
442 stars 110 forks source link

Issue with CSS resolver #213

Open priand opened 10 years ago

priand commented 10 years ago

Hi, I created my own UriLocator that is serving the files from the same server, but different application. For that I'm using a custom protocol like "localserver://fake/path/to/the/resource.css". But unfortunately, this is not recognized as a URL by the CSS processor and it is failing by throwing a WroRuntimeException in ro.isdc.wro.model.resource.processor.support.ImageUrlRewriter.rewrite(String, String) This method just knows a set of uri locators instead of trying to delegate to every single registered one. So it fails because mine is part of the hard code list. This is actually a blocker. Do you have any solution to overcome it?

priand commented 10 years ago

Actually, I fixed my own problem by using a Transformer. But I think that the CSS rewriter should delegate to the UriLocator.

alexo commented 10 years ago

@priand just curious, why creating new uriLocator instead reusing existing one (ex: urlUriLocator)?

priand commented 10 years ago

Because the existing urlUriLocator requires a whole url, including the server path. In my case, I want to implicitly use the current server, where a war containing the resources is deployed. Ok, now I'm using a transformer which replaces the partial url by a whole one. But I'm also working on other locator, like a 'dojo' one, where you specify the list of dojo modules in a form like: dojo:dojo/lang,dojo/base

alexo commented 10 years ago

If you find useful custom locators, I would appreciate if you would share your implementation ;)

priand commented 10 years ago

yes, this is the intent. I'm experimenting with them right now.