{"id":17472637,"url":"https://github.com/shinnn/postcss-filter-declarations","last_synced_at":"2025-03-28T08:10:42.713Z","repository":{"id":22280680,"uuid":"25615184","full_name":"shinnn/postcss-filter-declarations","owner":"shinnn","description":"PostCSS plugin to filter declarations by property names","archived":false,"fork":false,"pushed_at":"2019-01-08T18:11:53.000Z","size":13,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-02T08:42:11.442Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/shinnn.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2014-10-23T02:26:02.000Z","updated_at":"2020-02-15T15:08:10.000Z","dependencies_parsed_at":"2022-08-21T02:00:43.456Z","dependency_job_id":null,"html_url":"https://github.com/shinnn/postcss-filter-declarations","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fpostcss-filter-declarations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fpostcss-filter-declarations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fpostcss-filter-declarations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fpostcss-filter-declarations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shinnn","download_url":"https://codeload.github.com/shinnn/postcss-filter-declarations/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245991582,"owners_count":20706129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-18T17:29:42.693Z","updated_at":"2025-03-28T08:10:42.692Z","avatar_url":"https://github.com/shinnn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# postcss-filter-declarations\n\n[![npm version](https://img.shields.io/npm/v/postcss-filter-declarations.svg)](https://www.npmjs.com/package/postcss-filter-declarations)\n[![Build Status](https://travis-ci.com/shinnn/postcss-filter-declarations.svg?branch=master)](https://travis-ci.com/shinnn/postcss-filter-declarations)\n[![Coverage Status](https://img.shields.io/coveralls/shinnn/postcss-filter-declarations.svg)](https://coveralls.io/github/shinnn/postcss-filter-declarations)\n\nA [PostCSS](https://github.com/postcss/postcss) plugin to filter declarations by property names\n\n```javascript\nvar fs = require('fs');\n\nvar postcss = require('postcss');\nvar filterDeclarations = require('postcss-filter-declarations');\n\npostcss()\n  .use(filterDeclarations({props: ['display', 'color']}))\n  .process(fs.readFileSync('path/to/css/file'))\n  .css;\n```\n\n```css\n.menubar {\n  display: block;\n  position: fixed;\n  color: gray;\n}\n\n@media print {\n  h1 {\n    font-size: 16px;\n  }\n\n  a {\n    color: blue;\n  }\n}\n```\n\n↓\n\n```css\n.menubar {\n  display: block;\n  color: gray;\n}\n@media print {\n  h1 {\n  }\n\n  a {\n    color: blue;\n  }\n}\n```\n\n## Installation\n\n[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/).\n\n```\nnpm install postcss-filter-declarations\n```\n\n## API\n\n```javascript\nvar filterDeclarations = require('postcss-filter-declarations');\n```\n\n### filterDeclarations([options])\n\n*options*: `Object`  \nReturn: `Function`\n\n#### options.properties\n\n(alias: **options.props**)\n\nType: `Stirng` or `Array` of `String`  \nDefault: `[]`\n\nRemoves all [CSS declarations](https://github.com/postcss/postcss/blob/master/API.md#declaration-node) except for the proerties specified by this option.\n\n```javascript\npostcss()\n  .use(filterDeclarations({\n    props: 'color'\n  }))\n  .process('a {color: red;} b {background: blue;}')\n  .css; //=\u003e 'a {color: red;} b {}'\n```\n\n#### options.exclude\n\nType: `Boolean`  \nDefult: `false`\n\n`true` inverts the filtering result.\n\n```javascript\npostcss()\n  .use(filterDeclarations({\n    props: 'color',\n    exclude: true\n  }))\n  .process('a {color: red;} b {background: blue;}')\n  .css; //=\u003e 'a {} b {background: blue;}'\n```\n\n## License\n\nCopyright (c) 2014 - 2019 [Shinnosuke Watanabe](https://github.com/shinnn)\n\nLicensed under [the MIT License](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Fpostcss-filter-declarations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshinnn%2Fpostcss-filter-declarations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Fpostcss-filter-declarations/lists"}