{"id":15294926,"url":"https://github.com/privatenumber/vue-grep","last_synced_at":"2025-04-13T14:54:28.462Z","repository":{"id":57396102,"uuid":"356647083","full_name":"privatenumber/vue-grep","owner":"privatenumber","description":"Grep your Vue.js codebase with CSS selectors","archived":false,"fork":false,"pushed_at":"2021-04-12T02:52:12.000Z","size":320,"stargazers_count":18,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-04-13T14:54:23.945Z","etag":null,"topics":["css","grep","query","search","selector","vue","vuejs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/privatenumber.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":"2021-04-10T17:11:24.000Z","updated_at":"2024-07-18T03:18:35.000Z","dependencies_parsed_at":"2022-09-18T12:10:18.090Z","dependency_job_id":null,"html_url":"https://github.com/privatenumber/vue-grep","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Fvue-grep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Fvue-grep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Fvue-grep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Fvue-grep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/privatenumber","download_url":"https://codeload.github.com/privatenumber/vue-grep/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248732512,"owners_count":21152851,"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":["css","grep","query","search","selector","vue","vuejs"],"created_at":"2024-09-30T17:08:01.420Z","updated_at":"2025-04-13T14:54:28.440Z","avatar_url":"https://github.com/privatenumber.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cbr\u003e\n  \u003cimg src=\".github/vue-grep.png\" height=\"100px\"\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cem\u003eGrep your Vue.js codebase with CSS selectors\u003c/em\u003e\n  \u003cbr\u003e\n\n  \u003ca href=\"https://npm.im/vue-grep\"\u003e\u003cimg src=\"https://badgen.net/npm/v/vue-grep\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://packagephobia.now.sh/result?p=vue-grep\"\u003e\u003cimg src=\"https://packagephobia.now.sh/badge?p=vue-grep\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\nHave you ever wanted to [grep](https://phoenixnap.com/kb/grep-command-linux-unix-examples) your Vue.js codebase for something specific, like a combination of tags and attributes? Only to realize that you can't because attributes can span multiple lines and be in arbitrary order.\n\n**vue-grep** is a command-line tool that lets you search your Vue.js codebase using CSS selector syntax (like [`querySelectorAll`](https://developer.mozilla.org/en-US/docs/Web/API/Document_object_model/Locating_DOM_elements_using_selectors) or jQuery) — essential for navigating large codebases! 🔥\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\".github/screenshot.png\" width=\"70%\"\u003e\n\u003c/div\u003e\n\n\u003csub\u003eIf you like this project, please star it \u0026 [follow me](https://github.com/privatenumber) to see what other cool projects I'm working on! ❤️\u003c/sub\u003e\n\n## 🚀 Install\n```sh\n$ npm i -g vue-grep\n```\n\nAlternatively, use [npx](https://nodejs.dev/learn/the-npx-nodejs-package-runner) to run it without installation:\n```\n$ npx vue-grep\n```\n\n## 👨‍🏫 Usage\n\n```sh\n$ vue-grep \u003cquery\u003e [path/glob ...]\n```\n\n#### Tips\n\n- _Recommended to pass the query in with single-quotes to prevent [accidental interpolation](https://stackoverflow.com/a/6697781)_\n\n\teg. `$ vue-grep '[v-bind=\"$attrs\"]'`\n\n- _If passing in a glob, specify the `.vue` extension. (eg. `**/*.vue`)_\n\n### Options\n#### -l, --files-with-matches\nOnly print the paths with at least one match.\n#### -s, --show-children\nShow the children of matching elements. Defaults to being collapsed.\n\n#### --exclude-directory\nDirectory names to exclude on non-glob searches. (Default: `node_modules`, `vendor`, `public`, `dist`)\n\n#### --hidden\nSearch hidden files and directories.\n\n## 🌟 Query features\n### Standard selectors\n- [`tag-name`](https://developer.mozilla.org/en-US/docs/Web/CSS/Type_selectors) - Type selector\n- [`.class-name`](https://developer.mozilla.org/en-US/docs/Web/CSS/Class_selectors) - Class selector\n- [`#identifier`](https://developer.mozilla.org/en-US/docs/Web/CSS/ID_selectors) - ID selector\n- [Attribute selector](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors)\n  - `[attribute-name]` - Existence\n  - `[attribute-name=\"value\"]`/`[attribute-name!=\"value\"]` - Equality\n  - `[attribute-name=/pattern/]`/`[attribute-name!=/pattern/]` - Regular expression matching\n\n- Pseudo-classes\n  - [`:empty`](https://developer.mozilla.org/en-US/docs/Web/CSS/:empty) - Elements with no children\n  - [`:first-child`](https://developer.mozilla.org/en-US/docs/Web/CSS/:first-child) - First child amongst siblings\n  - [`:last-child`](https://developer.mozilla.org/en-US/docs/Web/CSS/:last-child) - Last child amongst siblings\n  - [`:nth-child(n)`](https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child) - _n_ th child amongst siblings\n  - [`:nth-last-child(n)`](https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-last-child) - _n_ th child from bottom amongst siblings\n  - [`:not(query)`](https://developer.mozilla.org/en-US/docs/Web/CSS/:not) - Query negation\n\n- Combinators\n  - [`parent child`](https://developer.mozilla.org/en-US/docs/Web/CSS/Descendant_combinator) - Descendant\n  - [`parent \u003e immediate-child`](https://developer.mozilla.org/en-US/docs/Web/CSS/Child_combinator) - Immediate child\n  - [`element ~ general-sibling`](https://developer.mozilla.org/en-US/docs/Web/CSS/General_sibling_combinator) - General sibling\n  - [`element + adjacent-sibling`](https://developer.mozilla.org/en-US/docs/Web/CSS/Adjacent_sibling_combinator) - Adjacent sibling\n\n### Non-standard selectors\n- Directive selector\n  - `[v-directive]` - Existence\n  - `[v-directive:argument]` - Existence with argument\n  - `[v-directive:argument.modifier]` - Existence with argument and modifier\n  - `[v-directive=\"value\"]`/`[v-directive!=\"value\"]` - Equality\n  - `[v-directive=/pattern/]`/`[v-directive!=/pattern/]` - Regular expression matching\n  - Directive shorthands\n    - `[:prop]`/`[:prop=\"value\"]`/`[:prop=/pattern/]` - Prop\n    - `[@event]`/`[@event=\"value\"]`/`[@event=/pattern/]` - Event-listener\n    - `[#slot]`/`[#slot=\"value\"]`/`[#slot=/pattern/]` - Slot\n- Pseudo-classes\n\t- `:contains(\"text\")` - Element that contains string\n\t- `:contains(/pattern/)` - Element that contains string that matches regular expression\n\n## ⚡️ Example queries\nAll examples are searching the current working directory.\n\n#### Find elements with class `button` and `primary`\n```sh\n$ vue-grep '.button.primary'\n```\n\nThe class selector can parse and test against dynamic classes aslong as it's simple (eg. no run-time evaluations). For matching complex class directives, consider using regular expression matching.\n\n#### Find `button` elements with the `@click.stop` listener\n```sh\n$ vue-grep 'button[@click.stop]'\n```\n\n#### Find radio `input` elements with a `disabled` prop\n```sh\n$ vue-grep 'input[type=\"radio\"][:disabled]'\n```\n\n#### Find `div` elements with `v-if`\n```sh\n$ vue-grep 'div[v-if]'\n```\n\n#### Find empty elements\n```sh\n$ vue-grep ':empty'\n```\n\n#### Find elements that contain strings that match regular expression `/hello world/`\n```sh\n$ vue-grep ':contains(/hello world/)'\n```\n\n### Don't see your favorite use-cases?\n[Add it in](https://github.com/privatenumber/vue-grep/edit/develop/README.md)! We'd love to see how you're using it.\n\n## 🙋‍♀️ Need help?\nIf you have a question about usage, [ask on Discussions](https://github.com/privatenumber/vue-grep/discussions).\n\nIf you'd like to make a feature request or file a bug report, [open an Issue](https://github.com/privatenumber/vue-grep/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprivatenumber%2Fvue-grep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprivatenumber%2Fvue-grep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprivatenumber%2Fvue-grep/lists"}