https://github.com/winston0410/postcss-sparrow-values-filter
A PostCSS Sparrow plugin that helps you search CSS declarations by values.
https://github.com/winston0410/postcss-sparrow-values-filter
postcss postcss-plugin postcss-sparrow
Last synced: 4 months ago
JSON representation
A PostCSS Sparrow plugin that helps you search CSS declarations by values.
- Host: GitHub
- URL: https://github.com/winston0410/postcss-sparrow-values-filter
- Owner: winston0410
- Created: 2020-09-09T06:22:39.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-06T07:42:00.000Z (10 months ago)
- Last Synced: 2025-01-11T13:26:33.237Z (6 months ago)
- Topics: postcss, postcss-plugin, postcss-sparrow
- Language: JavaScript
- Homepage:
- Size: 300 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PostCSS Sparrow Values Filter
[](https://snyk.io/test/github/winston0410/postcss-sparrow-values-filter?targetFile=package.json) [](https://codeclimate.com/github/winston0410/postcss-sparrow-values-filter/maintainability) [](https://codeclimate.com/github/winston0410/postcss-sparrow-values-filter/test_coverage) [](https://www.codacy.com/manual/winston0410/postcss-sparrow-values-filter?utm_source=github.com&utm_medium=referral&utm_content=winston0410/postcss-sparrow-values-filter&utm_campaign=Badge_Grade)
A PostCSS Sparrow plugin that helps you **search CSS declarations** by **values**.
This plugin is designed to be used with [PostCSS Sparrow](https://www.npmjs.com/package/postcss-sparrow), which helps you filter CSS declarations by **selectors**. By using these two plugins together, you can **easily get the declarations you need**.
## Made in Hong Kong :free: :free:
This plugin is made with love by a Hong Konger.
## Installation
This plugin require you to use [PostCSS Sparrow](https://www.npmjs.com/package/postcss-sparrow) for matching with selectors you want.
Download both `postcss-sparrow` and this plugin through NPM.
```shell
npm i postcss-sparrow postcss-sparrow-values-filter
```
Then import this plugin as the callback for [PostCSS Sparrow](https://www.npmjs.com/package/postcss-sparrow).
```javascript
//postcss.config.js
module.exports = {
plugins: [
//Other plugins...require('postcss-sparrow')({
transformations: [
{
selectors: ['*'],
inclusion: true,
callbacks: [
require('postcss-sparrow-values-filter')(
{
values: ['none'],
inclusion: true,
callbacks: [
//Do transformation here with your own callback functions
(decl) => {
decl.remove()
}
]
}
)
]
}
]
})
]
}
```## API Reference
### `options.values` : Array
An array of values that you want to match with. Use `*` as wildcard and select all values.
For example, `absolute` will match `position: absolute`.
### `options.inclusion` : Boolean
True for including and False for excluding values listed in `options.values`.
### `options.callbacks` : Array
An array of callbacks that you use to transform the selected declarations. The selected declaration will be passed in as an argument.