URL rewriting in CSS files

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

URL rewriting in CSS files

Mark Gibson-2
Hello,
Does anyone know how to get URL rewriting on CSS files,
ie. for cases like the following:

.someclass {
   background-image: url('oxf:/images/my-background.png');
}

or an alternative?

Cheers
--
Mark Gibson <gibsonm |AT| cromwell |DOT| co |DOT| uk>
Web Developer & Database Admin
Cromwell Tools Ltd.
Leicester, England.

___________________________________________________
 
This email is intended for the named recipient. The information contained
in it is confidential.  You should not copy it for any purposes, nor
disclose its contents to any other party.  If you received this email
in error, please notify the sender immediately via email, and delete it from
your computer.
 
Any views or opinions presented are solely those of the author and do not
necessarily represent those of the company.
 
Registered Office: PO Box 14, Chartwell Dr, Wigston, Leicester. LE18 1AT
__________________________________________________




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: URL rewriting in CSS files

Erik Bruchez
Administrator
Mark,

Currently there is no mechanism in place to rewrite URLs in CSS in OPS
(this sounds like a acronym contest ;-).

In passing, you would certainly not use an URL starting with "oxf:", as
that kind of URL is only accessible on the server.

What you can do, however, is store your CSS in a separate CSS file. In
that file, you can then use URLs relative to the base URI of the CSS
file, e.g. if your CSS file is:

   http://localhost:8888/ops/my-example/style.css

and contains:

   .someclass {
     background-image: url('images/my-background.png');
   }

the resulting URL for the image will be:

   http://localhost:8888/ops/my-example/images/my-background.png

This may or may not be useful in your case. It allows abstracting the
location from the context path, but it does not allow using URLs
relative to your (X)HTML page.

-Erik

Mark Gibson wrote:

> Hello,
> Does anyone know how to get URL rewriting on CSS files,
> ie. for cases like the following:
>
> .someclass {
>   background-image: url('oxf:/images/my-background.png');
> }
>
> or an alternative?
>
> Cheers



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: URL rewriting in CSS files

Mark Gibson-2
Erik Bruchez wrote:

> Mark,
>
> Currently there is no mechanism in place to rewrite URLs in CSS in OPS
> (this sounds like a acronym contest ;-).
>
> In passing, you would certainly not use an URL starting with "oxf:", as
> that kind of URL is only accessible on the server.
>
> What you can do, however, is store your CSS in a separate CSS file. In
> that file, you can then use URLs relative to the base URI of the CSS
> file, e.g. if your CSS file is:
>
>   http://localhost:8888/ops/my-example/style.css
>
> and contains:
>
>   .someclass {
>     background-image: url('images/my-background.png');
>   }
>
> the resulting URL for the image will be:
>
>   http://localhost:8888/ops/my-example/images/my-background.png
>
> This may or may not be useful in your case. It allows abstracting the
> location from the context path, but it does not allow using URLs
> relative to your (X)HTML page.
>
> -Erik
Ah, problem solved, I kept thinking that CSS URL's were relative to
the page URL.

Thank you.
--
Mark Gibson <gibsonm |AT| cromwell |DOT| co |DOT| uk>
Web Developer & Database Admin
Cromwell Tools Ltd.
Leicester, England.

___________________________________________________
 
This email is intended for the named recipient. The information contained
in it is confidential.  You should not copy it for any purposes, nor
disclose its contents to any other party.  If you received this email
in error, please notify the sender immediately via email, and delete it from
your computer.
 
Any views or opinions presented are solely those of the author and do not
necessarily represent those of the company.
 
Registered Office: PO Box 14, Chartwell Dr, Wigston, Leicester. LE18 1AT
__________________________________________________




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws