{"id":36500232,"url":"https://github.com/buildfirst/grunt-wordcount","last_synced_at":"2026-01-12T02:19:56.608Z","repository":{"id":13086491,"uuid":"15767625","full_name":"buildfirst/grunt-wordcount","owner":"buildfirst","description":"Demonstration of how to write a Grunt task. Counts words in files.","archived":false,"fork":false,"pushed_at":"2014-01-09T15:26:34.000Z","size":132,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-20T14:23:13.244Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://ponyfoo.com/books/javascript-application-design","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/buildfirst.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":"2014-01-09T13:38:38.000Z","updated_at":"2017-08-09T10:07:12.000Z","dependencies_parsed_at":"2022-09-14T07:11:56.126Z","dependency_job_id":null,"html_url":"https://github.com/buildfirst/grunt-wordcount","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/buildfirst/grunt-wordcount","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buildfirst%2Fgrunt-wordcount","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buildfirst%2Fgrunt-wordcount/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buildfirst%2Fgrunt-wordcount/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buildfirst%2Fgrunt-wordcount/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buildfirst","download_url":"https://codeload.github.com/buildfirst/grunt-wordcount/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buildfirst%2Fgrunt-wordcount/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28331982,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"online","status_checked_at":"2026-01-12T02:00:08.677Z","response_time":98,"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":[],"created_at":"2026-01-12T02:19:54.684Z","updated_at":"2026-01-12T02:19:56.603Z","avatar_url":"https://github.com/buildfirst.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Writing Your Own Task: `grunt-wordcount`\n\n_This repository is part of the **JavaScript Application Design: A Build First Approach** book's code samples_, the full original for the code samples [can be found here][1]. You can [learn more about the book itself here][2].\n\nThis tutorial is part of the code samples accompanying the book [in the appendix _Introduction to Grunt_][3], which walks you through the kind of things you can do, using Grunt.\n\n\u003e You might want to create your own Grunt tasks to help you shape your workflows. This example shows you how to do just that.\n\nFor the code in the book to work as [_a Grunt plugin_][5], I just placed it inside an exported task function, like below.\n\n```js\nmodule.exports = function (grunt) {\n  // register task\n};\n```\n\nWhich is pretty much the same pattern we see in a `Gruntfile.js`. Learn [more about Grunt plugins here][5].\n\n_**The walkthrough itself can be found in the book.**_\n\nBelow is how this README would actually look like if I were serious about open-sourcing it.\n\n# grunt-wordcount\n\n\u003e Grunt task to count words and set a word count threshold.\n\nCheck for updates in the [changelog](CHANGELOG.md).\n\n## Install\n\nTo consume it, install it from `npm`.\n\n```shell\nnpm i -D grunt-wordcount\n```\n\nRead [quick tips about npm][4].\n\n## Usage\n\nPick which files to count words from. Provide an optional `threshold`. If a `threshold` is provided, the task will fail unless it counts less words than that.\n\n```js\nwordcount: {\n  everything: {\n    files: {\n      src: ['**/*', '!node_modules/**']\n    }\n  },\n  capped: {\n    files: {\n      src: ['**/*', '!node_modules/**']\n    },\n    options: {\n      threshold: 30\n    }\n  }\n}\n```\n\n## Options\n\nJust the `threshold` for now.\n\n## License\n\nMIT\n\n  [1]: https://github.com/bevacqua/buildfirst\n  [2]: http://bevacqua.io/buildfirst \"JavaScript Application Design: A Build First Approach\"\n  [3]: https://github.com/bevacqua/buildfirst/tree/master/ch04\n  [4]: http://blog.ponyfoo.com/2013/12/14/9-quick-tips-about-npm\n  [5]: http://gruntjs.com/creating-plugins\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuildfirst%2Fgrunt-wordcount","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuildfirst%2Fgrunt-wordcount","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuildfirst%2Fgrunt-wordcount/lists"}