Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-resolve-nested-selector

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-resolve-nested-selector

Resolve a nested selector in a PostCSS AST

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.6M
decreased by-42.5%
Maintainers
2
Weekly downloads
 
Created
Source

postcss-resolve-nested-selector

test

Given a (nested) selector in a PostCSS AST, return an array of resolved selectors.

Tested to work with the syntax of postcss-nested and postcss-nesting. Should also work with SCSS and Less syntax. If you'd like to help out by adding some automated tests for those, that'd be swell. In fact, if you'd like to add any automated tests, you are a winner!

API

resolveNestedSelector(selector, node)

Returns an array of selectors resolved from selector.

For example, given this JS:

var resolvedNestedSelector = require('postcss-resolve-nested-selector');
postcssRoot.eachRule(function(rule) {
	rule.selectors.forEach(function(selector) {
		console.log(resolvedNestedSelector(selector, rule));
	});
});

And the following CSS:

.foo {
	.bar {
		color: pink;
	}
}

This should log:

['.foo']
['.foo .bar']

Or with this CSS:

.foo {
	.bar &,
	a {
		color: pink;
	}
}

This should log:

['.foo']
['.bar .foo']
['.foo a']

FAQs

Package last updated on 23 Jul 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc