Skip to content

startracex/unnestcss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unnestcss

Unnest CSS.

import { unnest } from "unnestcss";

unnest(`
.a {
  --a: A;
  .b {
    --b: B;
  }
}
`);
/* 
  Chrome 120+= (keep nesting)
  .a {
    --a: A;
    .b {
      --b: B;
    }
  }

  Chrome 120- (unnest)
  .a {
    --a:A;
   }
  .a .b{
    --b:B;
  }
*/

unnest(`
p {
  color: bisque;
  & {
    color: aqua;
  }
} 
`,false)
/* 
  p {
    color: bisque;
  }
  p:is(p) {
    color: aqua;
  }
*/

[MDN] Using CSS nesting

[MDN] Browser Compatibility