First of all, as a note, you could write your property mixin as

=property?(!property, !value)
  @if !value != "" and !value != "inherit" and !value != "transparent" and
!value != "none"
    #{!property} = !value

for conciseness.

I don't like the idea of wantonly adding new syntax. However, since empty
values have no meaning in CSS, I'd definitely consider the convention that
property = "" always means "don't display that property." Thoughts? Am I
overlooking something?

On Mon, Sep 14, 2009 at 7:00 AM, joneff <[email protected]> wrote:

>
> Examine the following snippet:
>
> =mixin(!a, !b, ..)
>        prop-a: !a
>        prop-b: !b ..
>
> It works fine if all arguments are provided even if I provide empty
> value e.g. "" or " ". So, to deal with this one, I made me self a
> short mixin:
>
> =property?(!property, !value)
>        @if !value != ""
>                @if !value != "inherit"
>                        @if !value != "transparent"
>                                @if !value != "none"
>                                        #{!property}: #{!value}
>
> which I use like this
>
> =mixin(!a = "", !b = "", ..)
>        +property("prop-a", !a)
>        +property("prop-b", !b) ..
>
> which works better and omits empty values. However, to me it would be
> nice to make something like
>
> =mixin(!a, !b, ..)
>        ? prop-a: !a
>        ? prop-b: !b ..
>
> which would do the same thing -- if !a exists, and is not "", and is
> not " ", then add this line to the css.
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to