https://github.com/komlev/postcss-current-selector
PostCSS for getting current selector
https://github.com/komlev/postcss-current-selector
Last synced: 7 months ago
JSON representation
PostCSS for getting current selector
- Host: GitHub
- URL: https://github.com/komlev/postcss-current-selector
- Owner: komlev
- License: mit
- Created: 2015-12-15T12:12:11.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-25T15:50:28.000Z (over 8 years ago)
- Last Synced: 2024-06-24T17:07:16.915Z (12 months ago)
- Language: JavaScript
- Homepage:
- Size: 8.79 KB
- Stars: 15
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# PostCSS Current Selector [![Build Status][ci-img]][ci]
[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-ancestorsWorks 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
[PostCSS]: https://github.com/postcss/postcss
[ci-img]: https://travis-ci.org/komlev/postcss-current-selector.svg
[ci]: https://travis-ci.org/komlev/postcss-current-selector```css
.foo {
$c: %@;
}
``````css
.foo {
$c: .foo;
}
```## Usage
```js
postcss([ require('postcss-current-selector') ])
```## Options
### `symbol`
By default, plugin will replace `%@` match in the declaration, but it could be changed with this option:
```js
postcss([ require('postcss-nested')({ symbol: '*@' }) ]
```
will look for `*@` text in declaration```css
.foo {
content: "*@";
}
``````css
.foo {
content: ".foo";
}
```