You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Michael Gentry <mg...@masslight.net> on 2009/07/28 22:46:18 UTC

T5.1 CSS + URL not loading images

Hi all,

I'm just getting started with T5.1 (used T4 a while back).  I have a
test application running at http://localhost:8888/t51 and I have a
stylesheet which has as part of the BODY tag:

  background: url(images/foo.jpg) repeat-x left top;

When I load the page, the stylesheet is being loaded (I've inspected
it), but the graphic doesn't show up.  It looks like T5.1 changed the
URL to:

http://localhost:8888/t51/assets/ctx/0.0.1-SNAPSHOT/css/images/foo.jpg

If I access http://localhost:8888/t51/images/foo.jpg directly in the
browser, I can see the graphic.  Any ideas as to how to get the image
to load out of the stylesheet?  I have the image stored under
src/main/webapp/images in Eclipse and created the project using the
Maven archetype.

Thanks!

mrg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.1 CSS + URL not loading images

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Tue, 28 Jul 2009 18:07:01 -0300, Michael Gentry <mg...@masslight.net>  
escreveu:

> I changed my BODY tag CSS to read:
>
>   background: url(../images/foo.jpg) repeat-x left top;
>
> and it worked.  No idea why that is needed, though.

I guess why: when you use a *relative* path in CSS, it is relative to the  
CSS file, not to the page that includes it. And T5.1 does asset  
versioning, so the CSS path can be different to what you expect.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.1 CSS + URL not loading images

Posted by Michael Gentry <mg...@masslight.net>.
I changed my BODY tag CSS to read:

  background: url(../images/foo.jpg) repeat-x left top;

and it worked.  No idea why that is needed, though.

mrg


On Tue, Jul 28, 2009 at 4:48 PM, Michael Gentry<mg...@masslight.net> wrote:
> I should've added that if I try accessing
> http://localhost:8888/t51/assets/ctx/0.0.1-SNAPSHOT/css/images/img01.jpg
> directly, I get:
>
> Unable to locate asset 'context:css/images/img01.jpg' (the file does not exist).
>
> Thanks again,
>
> mrg
>
>
> On Tue, Jul 28, 2009 at 4:46 PM, Michael Gentry<mg...@masslight.net> wrote:
>> Hi all,
>>
>> I'm just getting started with T5.1 (used T4 a while back).  I have a
>> test application running at http://localhost:8888/t51 and I have a
>> stylesheet which has as part of the BODY tag:
>>
>>   background: url(images/foo.jpg) repeat-x left top;
>>
>> When I load the page, the stylesheet is being loaded (I've inspected
>> it), but the graphic doesn't show up.  It looks like T5.1 changed the
>> URL to:
>>
>> http://localhost:8888/t51/assets/ctx/0.0.1-SNAPSHOT/css/images/foo.jpg
>>
>> If I access http://localhost:8888/t51/images/foo.jpg directly in the
>> browser, I can see the graphic.  Any ideas as to how to get the image
>> to load out of the stylesheet?  I have the image stored under
>> src/main/webapp/images in Eclipse and created the project using the
>> Maven archetype.
>>
>> Thanks!
>>
>> mrg
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.1 CSS + URL not loading images

Posted by Michael Gentry <mg...@masslight.net>.
I should've added that if I try accessing
http://localhost:8888/t51/assets/ctx/0.0.1-SNAPSHOT/css/images/img01.jpg
directly, I get:

Unable to locate asset 'context:css/images/img01.jpg' (the file does not exist).

Thanks again,

mrg


On Tue, Jul 28, 2009 at 4:46 PM, Michael Gentry<mg...@masslight.net> wrote:
> Hi all,
>
> I'm just getting started with T5.1 (used T4 a while back).  I have a
> test application running at http://localhost:8888/t51 and I have a
> stylesheet which has as part of the BODY tag:
>
>   background: url(images/foo.jpg) repeat-x left top;
>
> When I load the page, the stylesheet is being loaded (I've inspected
> it), but the graphic doesn't show up.  It looks like T5.1 changed the
> URL to:
>
> http://localhost:8888/t51/assets/ctx/0.0.1-SNAPSHOT/css/images/foo.jpg
>
> If I access http://localhost:8888/t51/images/foo.jpg directly in the
> browser, I can see the graphic.  Any ideas as to how to get the image
> to load out of the stylesheet?  I have the image stored under
> src/main/webapp/images in Eclipse and created the project using the
> Maven archetype.
>
> Thanks!
>
> mrg
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org