Nathan and I chatted for a while about this issue. We agree that
there's an awkward difference here between evaluated and non-evaluated
styles but the fix is not necessarily straightforward.
Here's the rub. In theory, there's no way for the Sass parser to be
100% certain whether you're referring to a resource or wanting
SassScript evaluation. Consider the following example:
div
background-image = url(2-1)
In theory this could be pointing to a resource named "2-1" in the same
directory as the compiled stylesheet, but then so could "1" -- the
result of performing an evaluation. Certainly this is just a corner
case. What are the chances that you're referring to a resource in the
same directory that happens to be named the same as a legal SassScript
expression? But the fact that it exists is extremely worrisome from a
language design perspective.
The leading option right now to address this issue is to do away with
evaluation mode (=) altogether and use interpolation(#{}) to access
SassScript in a style value. You can use Sass this way right now, so
we'd simply deprecate evaluation mode for the next release. This means
that if you wanted to point to a resource named "1" using the code
above you'd have to express it like so:
div
background-image: url(#{2-1})
But it also means that
div
background-image= url(!my_image_name)
would have to become:
div
background-image: url(#{!my_image_name})
Any feedback or other ideas are welcome.
Chris
On Nov 24, 8:55 am, "Chris Eppstein" <[EMAIL PROTECTED]> wrote:
> Well I made a changeset that makes the url function escaped, but now that I
> think about it, it's not the right approach because it precludes
> url(!my_file_name). I think maybe you're just going to have to add quotes
> when in evaluation mode (=).
>
> Nathan, do you think there's a bug here?
>
> for reference, here's the change I made. I'll be dumping it shortly --
> bummer cuz it was pretty clean code.
>
> http://github.com/chriseppstein/haml/commit/fa9092798194384df0caaed89...
>
> On Mon, Nov 24, 2008 at 7:32 AM, Chris Eppstein <[EMAIL PROTECTED]>wrote:
>
>
>
> > I'll look into this right away. As a work-around for now you can place
> > your image name in quotes.
>
> > chris
>
> > On Nov 24, 3:43 am, jazen <[EMAIL PROTECTED]> wrote:
> > > Hello,
>
> > > i'm using Edge Rails, Ruby 1.8.6 and (Edge) Haml and ran into the
> > > following issues:
>
> > > Sass::SyntaxError: Undefined operation "-960 minus yellow"
> > > ...
> > > background = !highlight_color url(../images/bg-box-bottom-960-
> > > yellow.png) no-repeat 0 bottom
>
> > > Sass::SyntaxError: Expected expression, was and token
> > > ...
> > > background = transparent url(../images/repl-de-logo-and-slogan.png) no-
> > > repeat 11px 0
>
> > > and Sass evaluates color aliases into their codes, e.g.:
>
> > > background-image = url(../images/bg-arrow-red-down.gif)
> > > becomes
> > > background-image = url(../images/bg-arrow-#ff0000-down.gif)
> > > (Firebug revealed this)
>
> > > /jazen
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---