Skip to content

komlev/postcss-current-selector

Repository files navigation

PostCSS Current Selector Build Status

PostCSS plugin which helps you get your current selector. [postcss-simple-vars]: https://github.com/postcss/postcss-simple-vars [postcss-nested-ancestors]: https://github.com/toomuchdesign/postcss-nested-ancestors

Works great with [postcss-simple-vars] for example to get your current selector as a variable

Alternativly you can use [postcss-nested-ancestors] plugin to reference parent selectors

.foo {
    $c: %@;
}
.foo {
    $c: .foo;
}

Usage

postcss([ require('postcss-current-selector') ])

Options

symbol

By default, plugin will replace %@ match in the declaration, but it could be changed with this option:

postcss([ require('postcss-nested')({ symbol: '*@' }) ]

will look for *@ text in declaration

.foo {
    content: "*@";
}
.foo {
    content: ".foo";
}

About

PostCSS for getting current selector

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published