Skip to content

Mixin Quantity Queries #189

@dbox

Description

@dbox
// Mixin Quantity Queries

quantity-at-least(count=4, selector=li)
  & > {selector}:nth-last-child(n+{count})
  & > {selector}:nth-last-child(n+{count}) ~ {selector}
    {block}

quantity-at-most(count=4, selector=li)
  & > {selector}:nth-last-child(-n+{count}):first-child
  & > {selector}:nth-last-child(-n+{count}):first-child ~ {selector}
    {block}

quantity-between(start=0, end=10, selector=li)
  & > {selector}:nth-last-child(n+{start}):nth-last-child(-n+{end}):first-child
  & > {selector}:nth-last-child(n+{start}):nth-last-child(-n+{end}):first-child ~ {selector}
    {block}

quantity-exactly(count=4, selector=li)
  & > {selector}:nth-last-child({count}):first-child
  & > {selector}:nth-last-child({count}):first-child ~ {selector}
    {block}

// usage
ul.least
  +quantity-at-least(2)
    border: 1px solid blue 

demo here:

http://codepen.io/dbox/pen/waeQOL

I'll get these PR'd in soon. Thanks to @declandewet and @abstracthat

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions