Skip to content

Nested rules #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nsaunders opened this issue Mar 16, 2022 · 0 comments
Open

Nested rules #153

nsaunders opened this issue Mar 16, 2022 · 0 comments

Comments

@nsaunders
Copy link
Member

nsaunders commented Mar 16, 2022

I was experimenting a bit with Clay today and found that it allows a nested selector to reference its parent, similar to & in languages like Sass and LESS.

Examples

Nested "self" with refinement

main = do
  putCss $ do
    star # byClass "foo" ? do
      byClass "bar" & do
        width nil

yields

.bar.foo
{
  width : 0;
}

Nested child

main = do
  putCss $ do
    star # byClass "foo" ? do
      star # byClass "bar" <? do
        width nil

yields

.foo > .bar
{
  width : 0;
}
@nsaunders nsaunders changed the title Nested rules can't reference parent selector Nested rules Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant