Skip to content

Small feature tweak - keyword "or" #2705

Closed

Description

@matthew-dean

When guards were added to Less, CSS did not use an "or" operator (that is: the word or), so the closest parallel was the use of the comma in @media queries.

Now that @supports has been added, it mostly follows the syntax of @media but for whatever reason, W3C went with an explicit "or" instead of a comma.

So, to allow some flexibility and maybe make new devs a little happier, I suggest we allow either a comma or the or keyword in guards.

// equal
.mixin (@a) when (@a > 10), (@a < -10) { ... }
.mixin (@a) when (@a > 10) or (@a < -10) { ... }

I can't imagine this is a controversial change, especially given the added syntax in CSS. But, might as well put it out there before making a PR.

Oh, and if/when implemented, it would make sense to me to substitute "or" in the documentation for mixin examples, and just note that a comma can be used like @media.

Activity

  1. seven-phases-max commented on Oct 1, 2015

    @seven-phases-max
    Member

    +1

  2. SomMeri commented on Oct 1, 2015

    @SomMeri
    Member

    +1

    Plus, ability to use or inside parentheses when ((cond1) or (cond2)) and (@a < -10) would be great too.

  3. matthew-dean commented on Oct 1, 2015

    @matthew-dean
    MemberAuthor

    @SomMeri That seems reasonable too.

  4. matthew-dean commented on Oct 1, 2015

    @matthew-dean
    MemberAuthor

    I'll mark as ready for implementation. If someone figures out a strong objection, we can change it.

  5. lukeapage commented on Oct 2, 2015

    @lukeapage
    Member

    +1

  6. SomMeri commented on Dec 16, 2015

    @SomMeri
    Member

    @matthew-dean Are you working on this or want to work on this?

  7. matthew-dean commented on Dec 16, 2015

    @matthew-dean
    MemberAuthor

    @SomMeri I don't have time for it currently. Should be a small change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions