{"id":15675428,"url":"https://github.com/doowb/gulp-routes","last_synced_at":"2025-05-07T00:25:11.919Z","repository":{"id":24402803,"uuid":"27803201","full_name":"doowb/gulp-routes","owner":"doowb","description":"Add middleware to run for specified routes in your gulp pipeline.","archived":false,"fork":false,"pushed_at":"2017-08-07T07:13:29.000Z","size":17,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-24T05:02:03.829Z","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/doowb.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-12-10T05:04:18.000Z","updated_at":"2019-08-13T15:57:31.000Z","dependencies_parsed_at":"2022-08-28T21:41:51.630Z","dependency_job_id":null,"html_url":"https://github.com/doowb/gulp-routes","commit_stats":null,"previous_names":["assemble/gulp-routes"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgulp-routes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgulp-routes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgulp-routes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgulp-routes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doowb","download_url":"https://codeload.github.com/doowb/gulp-routes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252429932,"owners_count":21746571,"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-03T16:00:08.578Z","updated_at":"2025-05-07T00:25:11.893Z","avatar_url":"https://github.com/doowb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gulp-routes [![NPM version](https://img.shields.io/npm/v/gulp-routes.svg?style=flat)](https://www.npmjs.com/package/gulp-routes) [![NPM monthly downloads](https://img.shields.io/npm/dm/gulp-routes.svg?style=flat)](https://npmjs.org/package/gulp-routes) [![NPM total downloads](https://img.shields.io/npm/dt/gulp-routes.svg?style=flat)](https://npmjs.org/package/gulp-routes) [![Linux Build Status](https://img.shields.io/travis/assemble/gulp-routes.svg?style=flat\u0026label=Travis)](https://travis-ci.org/assemble/gulp-routes)\n\n\u003e Add middleware to run for specified routes in your gulp pipeline.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save gulp-routes\n```\n\n## Usage\n\n### [routes](index.js#L43)\n\nThe main export is a function that takes an instance of [en-route](https://github.com/jonschlinkert/en-route) and returns a [gulp](http://gulpjs.com) plugin function.\n\n**Params**\n\n* `enRoute` **{Object}**: Instance of [en-route](https://github.com/jonschlinkert/en-route).\n* `returns` **{Function}**\n\n**Example**\n\n```js\nvar routes = require('gulp-routes');\nvar Router = require('en-route').Router;\nvar router = new Router();\n\n// define middleware\nrouter.all(/\\.hbs/, function (file, next) {\n  var str = file.contents.toString();\n  // do anything to `file` that can be done\n  // in a gulp plugin\n  file.contents = new Buffer(str);\n  next();\n});\n\n// pass the router to `gulp-routes`\nvar route = routes(router);\n\ngulp.src('*.hbs')\n  .pipe(route())\n  .pipe(gulp.dest('_gh_pages/'));\n```\n\n### [route](index.js#L66)\n\nCreate a router stream to run middleware for the specified method.\n\n**Params**\n\n* `method` **{String}**: Method to run middleware.\n* `returns` **{Stream}**: Returns a stream for piping files through.\n\n**Example**\n\n```js\ngulp.src('*.hbs')\n  .pipe(route('before'))\n  .pipe(otherPlugin())\n  .pipe(route('after'))\n  .pipe(gulp.dest('dist/'));\n```\n\n## About\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [base-routes](https://www.npmjs.com/package/base-routes): Plugin for adding routes support to your `base` application. Requires templates support to work. | [homepage](https://github.com/node-base/base-routes \"Plugin for adding routes support to your `base` application. Requires templates support to work.\")\n* [base](https://www.npmjs.com/package/base): Framework for rapidly creating high quality node.js applications, using plugins like building blocks | [homepage](https://github.com/node-base/base \"Framework for rapidly creating high quality node.js applications, using plugins like building blocks\")\n* [en-route](https://www.npmjs.com/package/en-route): Routing for static site generators, build systems and task runners, heavily based on express.js routes… [more](https://github.com/jonschlinkert/en-route) | [homepage](https://github.com/jonschlinkert/en-route \"Routing for static site generators, build systems and task runners, heavily based on express.js routes but works with file objects. Used by Assemble, Verb, and Template.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Contributors\n\n| **Commits** | **Contributor** | \n| --- | --- |\n| 6 | [jonschlinkert](https://github.com/jonschlinkert) |\n| 5 | [doowb](https://github.com/doowb) |\n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n### Running tests\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n### Author\n\n**Brian Woodward**\n\n* [github/doowb](https://github.com/doowb)\n* [twitter/doowb](https://twitter.com/doowb)\n\n### License\n\nCopyright © 2017, [Brian Woodward](https://github.com/doowb).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on August 07, 2017._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fgulp-routes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoowb%2Fgulp-routes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fgulp-routes/lists"}