Socket
Socket
Sign inDemoInstall

postcss-resolve-nested-selector

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    postcss-resolve-nested-selector

Resolve a nested selector in a PostCSS AST


Version published
Weekly downloads
4.1M
increased by2.23%
Maintainers
1
Install size
4.63 kB
Created
Weekly downloads
 

Readme

Source

postcss-resolve-nested-selector

Build Status

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

Last updated on 19 Feb 2016

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc