{"id":16484462,"url":"https://github.com/winston0410/sparrow","last_synced_at":"2026-06-28T05:32:09.397Z","repository":{"id":57328539,"uuid":"286339161","full_name":"winston0410/sparrow","owner":"winston0410","description":"A PostCSS plugin that helps you remove, replace, append or prepend CSS declarations without the need of writing another PostCSS plugin","archived":false,"fork":false,"pushed_at":"2020-09-30T10:52:55.000Z","size":2902,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-26T21:36:49.016Z","etag":null,"topics":["hongkong","postcss","postcss-plugins"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/winston0410.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-10T00:17:44.000Z","updated_at":"2020-09-30T10:17:12.000Z","dependencies_parsed_at":"2022-09-21T01:52:21.856Z","dependency_job_id":null,"html_url":"https://github.com/winston0410/sparrow","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/winston0410/sparrow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winston0410%2Fsparrow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winston0410%2Fsparrow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winston0410%2Fsparrow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winston0410%2Fsparrow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/winston0410","download_url":"https://codeload.github.com/winston0410/sparrow/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winston0410%2Fsparrow/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34878963,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hongkong","postcss","postcss-plugins"],"created_at":"2024-10-11T13:17:11.843Z","updated_at":"2026-06-28T05:32:09.374Z","avatar_url":"https://github.com/winston0410.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sparrow\n\n[![Known Vulnerabilities](https://snyk.io/test/github/winston0410/sparrow/badge.svg?targetFile=package.json)](https://snyk.io/test/github/winston0410/sparrow?targetFile=package.json) [![Maintainability](https://api.codeclimate.com/v1/badges/54626992beea73efcadf/maintainability)](https://codeclimate.com/github/winston0410/sparrow/maintainability) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/4f5f78d7736d4ed7b8439c2096bdc38f)](https://www.codacy.com/manual/winston0410/sparrow?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=winston0410/sparrow\u0026utm_campaign=Badge_Grade) [![Test Coverage](https://api.codeclimate.com/v1/badges/54626992beea73efcadf/test_coverage)](https://codeclimate.com/github/winston0410/sparrow/test_coverage)\n\n![Cover image for PostCSS Sparrow](./cover.jpg)\n\nA PostCSS plugin that helps you **search CSS declarations and rules** by **selectors**. Avoid the hassle of reinventing the wheel and filter selectors you want again when you create a new PostCSS plugin.\n\n```css\n/* Original Input */\n.foo {\n  padding: 4px;\n  font-size: 20px;\n  letter-spacing: 10px;\n}\n\n.bar {\n  margin: 50px;\n  padding: 4px;\n}\n```\n\n```javascript\n//postcss.config.js or other files you use to config PostCSS\n\nmodule.exports = {\n  plugins: [\n    //Other plugins...\n\n    require('postcss-sparrow')({\n      declarations: [\n        {\n          selectors: ['*'],\n          inclusion: true,\n          callbacks: [\n            (decl) =\u003e {\n              //Decl is the declaration object selected based on your options.\n              //Do transformation to decl here\n              if(decl.prop === 'padding'){\n                decl.remove()\n              }\n            },\n            //You can also import plugins here\n            require(\"postcss-sparrow-auto-text-indent\")\n          ]\n        }\n      ]\n    })\n  ]\n}\n```\n\n```css\n/* After the transformation of sparrow*/\n.foo {\n  font-size: 20px;\n  letter-spacing: 10px;\n  text-indent: 10px;\n}\n\n.bar {\n  margin: 50px;\n}\n```\n\n## What can sparrow do for me?\n\nWith the power of Sparrow, you can easily **filter selectors** and transform them using PostCSS Sparrow plugins. You do not need to write filter logic again for a PostCSS plugin. **Focus on transforming CSS** instead.\n\nCheck out [all PostCSS Sparrow plugins here](https://github.com/winston0410/sparrow/blob/master/LIST.md).\n\n## Made in Hong Kong :free: :free:\n\nThis plugin is made with love by a Hong Konger.\n\n## Installation\n\nAs this plugin is a PostCSS plugin, you need to install and set up PostCSS first before use it. If you haven't used PostCSS before, set it up according to [official docs](https://github.com/postcss/postcss#usage).\n\nInput this command in terminal and download this PostCSS plugin.\n\n```shell\nnpm i postcss-sparrow\n```\n\nAs this plugin requires PostCSS to parse your CSS first, you need to include it after plugins like [postcss-nested](https://www.npmjs.com/package/postcss-nested) or [postcss-mixins](https://www.npmjs.com/package/postcss-mixins).\n\n## API Reference\n\n### `options.rules`\n\nFor matching CSS Rules. E.g. `a{}`.\n\n#### `options.rules.selectors` : Array\n\nAn array of selectors that you want to match with. Use `*` as wildcard and select all selectors.\n\n#### `options.rules.inclusion` : Boolean\n\nTrue for including and False for excluding selectors listed in `options.selectors`.\n\n#### `options.rules.callbacks` : Array\n\nAn array of callbacks that you use to transform the selected declarations. The selected declaration will be passed in as an argument.\n\n### `options.declarations`\n\nFor matching CSS Declarations. E.g. `font-size: 18px;`.\n\n#### `options.declarations.selectors` : Array\n\nAn array of selectors that you want to match with. Use `*` as wildcard and select all selectors.\n\n#### `options.declarations.inclusion` : Boolean\n\nTrue for including and False for excluding selectors listed in `options.selectors`.\n\n#### `options.declarations.callbacks` : Array\n\nAn array of callbacks that you use to transform the selected declarations. The selected declaration will be passed in as an argument.\n\n## Breaking changes\n\n### V1.0.0\n\nPostCSS Sparrow has upgraded its code for PostCSS 8\\. It will not be compatible with any version lower than 8.0.0.\n\n### V2.0.0\n\nPostCSS Sparrow now filter for **Declarations**, **Rules** and **AtRules**. Therefore, `options.transformations` which originally used for filtering declarations is renamed to `options.declarations`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinston0410%2Fsparrow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwinston0410%2Fsparrow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinston0410%2Fsparrow/lists"}