{"id":15579722,"url":"https://github.com/schickling/gulp-webserver","last_synced_at":"2025-04-08T08:13:18.517Z","repository":{"id":18340794,"uuid":"21520414","full_name":"schickling/gulp-webserver","owner":"schickling","description":"Streaming gulp plugin to run a local webserver with LiveReload","archived":false,"fork":false,"pushed_at":"2022-12-19T18:32:27.000Z","size":581,"stargazers_count":356,"open_issues_count":71,"forks_count":81,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-01T05:34:10.755Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.org/package/gulp-webserver","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/schickling.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-07-05T13:20:32.000Z","updated_at":"2025-03-22T21:48:18.000Z","dependencies_parsed_at":"2023-01-13T19:46:53.790Z","dependency_job_id":null,"html_url":"https://github.com/schickling/gulp-webserver","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schickling%2Fgulp-webserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schickling%2Fgulp-webserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schickling%2Fgulp-webserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schickling%2Fgulp-webserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/schickling","download_url":"https://codeload.github.com/schickling/gulp-webserver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247801169,"owners_count":20998339,"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-02T19:20:47.750Z","updated_at":"2025-04-08T08:13:18.490Z","avatar_url":"https://github.com/schickling.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"gulp-webserver [![Build Status](http://img.shields.io/travis/schickling/gulp-webserver.svg?style=flat)](https://travis-ci.org/schickling/gulp-webserver) [![](http://img.shields.io/npm/dm/gulp-webserver.svg?style=flat)](https://www.npmjs.org/package/gulp-webserver) [![](http://img.shields.io/npm/v/gulp-webserver.svg?style=flat)](https://www.npmjs.org/package/gulp-webserver)\n==============\n\n\u003e Streaming gulp plugin to run a local webserver with LiveReload\n\n##### Hint: This is a rewrite of [gulp-connect](https://github.com/AveVlad/gulp-connect/)\n\n## Install\n\n```sh\n$ npm install --save-dev gulp-webserver\n```\n\n## Usage\n\nThe `gulp.src('root')` parameter is the root directory of the webserver. Multiple directories are possible.\n\n```js\nvar gulp = require('gulp');\nvar webserver = require('gulp-webserver');\n\ngulp.task('webserver', function() {\n  gulp.src('app')\n    .pipe(webserver({\n      livereload: true,\n      directoryListing: true,\n      open: true\n    }));\n});\n```\n\n## Options\n\nKey | Type | Default | Description |\n--- | --- | --- | --- |\n`host` | String | `localhost` | hostname of the webserver\n`port` | Number | `8000` | port of the webserver\n`path` | String | `/` | path to the webserver\n`livereload` | Boolean/Object | `false` | whether to use livereload. For advanced options, provide an object. You can use the 'port' property to set a custom live reload port and the `filter` function to filter out files to watch. The object also needs to set `enable` property to true (e.g. `enable: true`) in order to activate the livereload mode. It is off by default.\n`directoryListing` | Boolean/Object | `false` | whether to display a directory listing. For advanced options, provide an object with the 'enable' property set to true. You can use the 'path' property to set a custom path or the 'options' property to set custom [serve-index](https://github.com/expressjs/serve-index) options.\n`fallback` | String | `undefined` | file to fall back to (relative to webserver root)\n`open` | Boolean/String | `false` | open the localhost server in the browser. By providing a String you can specify the path to open (for complete path, use the complete url `http://my-server:8080/public/`) .\n`https` | Boolean/Object | `false` | whether to use https or not. By default, `gulp-webserver` provides you with a development certificate but you remain free to specify a path for your key and certificate by providing an object like this one: `{key: 'path/to/key.pem', cert: 'path/to/cert.pem'}`.\n`middleware` | Function/Array | `[]` | a connect middleware function or a list of middleware functions\n`proxies` | Array | `[]`| a list of proxy objects.  Each proxy object can be specified by `{source: '/abc', target: 'http://localhost:8080/abc', options: {headers: {'ABC_HEADER': 'abc'}}}`.\n\n## FAQ\n\n#### Why can't I reach the server from the network?\n\n**Solution**: Set `0.0.0.0` as `host` option.\n\n#### How can I use `html5Mode` for my single page app with this plugin?\n\n**Solution**: Set the `index.html` of your application as `fallback` option. For example:\n\n```js\ngulp.task('webserver', function() {\n  gulp.src('app')\n    .pipe(webserver({\n      fallback: 'index.html'\n    }));\n});\n```\n\n#### How can I pass a custom filter to livereload?\n\n**Solution**: Set `enable: true` and provide filter function in `filter:` property of the livereload object. For example:\n\n```js\ngulp.task('webserver', function() {\n  gulp.src('app')\n    .pipe(webserver({\n      livereload: {\n        enable: true, // need this set to true to enable livereload\n        filter: function(fileName) {\n          if (fileName.match(/.map$/)) { // exclude all source maps from livereload\n            return false;\n          } else {\n            return true;\n          }\n        }\n      }\n    }));\n});\n```\n\n#### How can I kill the running server?\n\n**Solution**: Either by pressing `Ctrl + C` or programmatically like in this example:\n\n```js\nvar stream = gulp.src('app').pipe(webserver());\nstream.emit('kill');\n```\n\n## License\n\n[MIT License](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschickling%2Fgulp-webserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschickling%2Fgulp-webserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschickling%2Fgulp-webserver/lists"}