[Seaside] Support for CSS?

Avi Bryant avi@beta4.com
Thu, 25 Apr 2002 15:10:55 -0700 (PDT)


On Thu, 25 Apr 2002, Nevin Pratt wrote:

> I've tried the following embedded CSS code within the header area of an
> html file (both with and without the quotes around the background image
> URL), and it doesn't seem to be expanded by Seaside (I've set the
> document root of the Seaside app to 'http://www.test.com').  Instead, it
> seems to be treated as literal text, and thus the browser receives it
> just like this, and of course can't make sense of the '@' in the URL.
>
>    <style type="text/css">
>    <!--
>    body {background-image: url(@images/background.jpg)}
>    -->
>    </style>

Ok, basic misunderstanding here.
There is nothing special about the @ character *except* when it's in the
attribute of a tag.  There is a direct macro expansion from
<foo someattr="@someid"> to <foo sea:id="someid">.
In any other context, the @ symbol is, indeed, treated as literal text.

When you're used to textual templating systems, this may be a little
strange to get used to.  It's kinda like the difference between the C
preprocessor's macros and syntactic macros in lisp or dylan.  By and
large, what's going on here has nothing to do with textual expansion.  The
fact that it sometimes looks like it does is simply a matter of shortcuts
and defaults.

In other words, all that <img src="@foo.jpg"> is doing, is creating an
IAImage element, with an id of 'foo.jpg'.  Now, IAImage *happens*, by
default, to append the document root to its id and use that as a src
attribute.  But that's a property of IAImage, not of the @ syntax.

Dealing with external resources is clearly a pain, and we'll have to find
better ways to do it.