{"id":16760274,"url":"https://github.com/ryanve/reap-css","last_synced_at":"2026-05-04T16:37:01.548Z","repository":{"id":57348946,"uuid":"94289717","full_name":"ryanve/reap-css","owner":"ryanve","description":"CSS AST traversal filters ","archived":false,"fork":false,"pushed_at":"2017-06-28T19:03:51.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T21:51:23.201Z","etag":null,"topics":["ast","css","javascript","nodejs","traversal"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/reap-css","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryanve.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-14T04:41:53.000Z","updated_at":"2023-08-08T21:06:28.000Z","dependencies_parsed_at":"2022-09-17T22:50:43.707Z","dependency_job_id":null,"html_url":"https://github.com/ryanve/reap-css","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/ryanve%2Freap-css","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Freap-css/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Freap-css/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Freap-css/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanve","download_url":"https://codeload.github.com/ryanve/reap-css/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243847056,"owners_count":20357317,"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":["ast","css","javascript","nodejs","traversal"],"created_at":"2024-10-13T04:22:57.405Z","updated_at":"2026-05-04T16:37:01.514Z","avatar_url":"https://github.com/ryanve.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# reap-css\nCSS AST traversal filters designed for CSS parsed by [`read-css`](https://www.npmjs.com/package/read-css) or [`css.parse`](https://www.npmjs.com/package/css)\n\n## install\n```\nnpm install reap-css\n```\n\n## usage\n\n```js\nconst reap = require('reap-css')\nconst read = require('read-css')\nconst tree = read(\"test.css\")\nconst harvest = reap(tree)\n\nharvest.selectors() // [\".apple\", \".orange\", \"button:enabled\", \".flex\\\\@portrait\"]\nharvest.properties() // [\"color\", \"border-radius\", \"color\", \"cursor\", \"display\"]\nharvest.media() // [\"(color), (update)\", \"(orientation: portrait)\"]\n```\n\n## methods\n\n### `.selectors()`\n\nCollect array of selectors.\n\n```js\nreap(tree).selectors()\n```\n\n### `.properties()`\n\nCollect array of properties.\n\n```js\nreap(tree).properties()\n```\n\n### `.media()`\n\nCollect array of media queries.\n\n```js\nreap(tree).media()\n```\n\n### `.collect(key)`\n\nCollect array of values.\n\n```js\nreap(tree).collect(\"selectors\")\n```\n\n### `.having(key)`\n\nGet array of AST nodes having the specified key\n\n```js\nreap(tree).having(\"media\")\n```\n\n### `.type(type)`\n\nGet array of AST nodes with the specified type.\n\n```js\nreap(tree).type(\"rule\")\n```\n\n## traversal\n\nReap uses [traverse](https://www.npmjs.com/package/traverse) to travese the AST. The traversal instance for the current tree is accessible via `.traversal`\n\n```js\nreap(tree).traversal\n```\n\n## develop\n\n```\nnpm install\nnpm test\nnpm run demo\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanve%2Freap-css","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanve%2Freap-css","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanve%2Freap-css/lists"}