![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
postcss-nested-ancestors
Advanced tools
PostCSS plugin to reference any ancestor selector in nested CSS
PostCSS plugin to reference any ancestor selector in nested CSS.
When writing modular nested CSS, &
current parent selector is often not enough.
PostCSS Nested ancestors introduce ^&
selector which let you reference any parent ancestor selector with an easy and customizable interface.
This plugin should be used before a POSTCSS rules unwrapper like postcss-nested.
See PostCSS docs for examples for your environment.
.level-1 {
| | .level-2 {
| | | .level-3 {
| | | | .level-4 {
| | | | |
| | | | --- & {} /* & = ".level-1 .level-2 .level-3 .level-4" */
| | | ------- ^& {} /* ^& = ".level-1 .level-2 .level-3" */
| | ----------- ^^& {} /* ^^& = ".level-1 .level-2" */
| --------------- ^^^& {} /* ^^^& = ".level-1" */
------------------- ^^^^& {} /* ^^^^& = "" */
}
}
}
}
/* Without postcss-nested-ancestors */
.MyComponent
&-part{}
&:hover {
> .MyComponent-part {} /* Must manually repeat ".MyComponent" for each child */
}
}
/* With postcss-nested-ancestors */
.MyComponent
&-part{}
&:hover {
> ^&-part {} /* Skip ":hover" inheritance here */
}
}
/* After postcss-nested-ancestors */
.MyComponent {
&-part{}
&:hover {
> .MyComponent-part {}
}
/* After postcss-nested */
.MyComponent {}
.MyComponent-part {}
.MyComponent:hover {}
.MyComponent:hover > .MyComponent-part {} /* No ":hover" inheritance here! */
Currently another plugin - postcss-current-selector - has tried to solve the problem of referencing ancestors selector. It works great, but its approach involves assigning ancestor selectors to special variables to be later processed by a further postcss plugin postcss-simple-vars.
[postcss-nested-ancestors] instead replaces special ancestor selectors, makes no use of variable assignment and produces an output ready to be unwrapped with postcss-nested.
$ npm install postcss-nested-ancestors
postcss([ require('postcss-nested-ancestors') ]);
Type: string
Default: ^&
Ancestor selector pattern (utility option to automatically set both levelSymbol
and parentSymbol
)
Type: string
Default: ^
Define ancestor selector fragment reative to the matching nesting level
Type: string
Default: &
Ancestor selector base symbol
0.0.1
levelSymbol
and parentSymbol
options not being usedFAQs
PostCSS plugin to reference any ancestor selector in nested CSS
The npm package postcss-nested-ancestors receives a total of 8,868 weekly downloads. As such, postcss-nested-ancestors popularity was classified as popular.
We found that postcss-nested-ancestors demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.