-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
66 lines (66 loc) · 7.48 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
"name": "grunt-contrib-connect",
"description": "Start a connect web server.",
"version": "0.2.0",
"homepage": "https://github.com/gruntjs/grunt-contrib-connect",
"author": {
"name": "Grunt Team",
"url": "http://gruntjs.com/"
},
"repository": {
"type": "git",
"url": "git://github.com/gruntjs/grunt-contrib-connect.git"
},
"bugs": {
"url": "https://github.com/gruntjs/grunt-contrib-connect/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/gruntjs/grunt-contrib-connect/blob/master/LICENSE-MIT"
}
],
"main": "Gruntfile.js",
"engines": {
"node": ">= 0.8.0"
},
"scripts": {
"test": "grunt test"
},
"dependencies": {
"connect": "~2.7.3"
},
"devDependencies": {
"grunt-contrib-jshint": "~0.2.0",
"grunt-contrib-nodeunit": "~0.1.2",
"grunt-contrib-internal": "~0.4.2",
"grunt": "~0.4.0"
},
"peerDependencies": {
"grunt": "~0.4.0"
},
"keywords": [
"gruntplugin",
"server",
"connect",
"http"
],
"contributors": [
{
"name": "\"Cowboy\" Ben Alman",
"url": "http://benalman.com"
},
{
"name": "Tyler Kellen",
"url": "http://goingslowly.com"
},
{
"name": "Sindre Sorhus",
"url": "http://sindresorhus.com"
}
],
"readme": "# grunt-contrib-connect [![Build Status](https://secure.travis-ci.org/gruntjs/grunt-contrib-connect.png?branch=master)](http://travis-ci.org/gruntjs/grunt-contrib-connect)\n\n> Start a connect web server.\n\n\n\n## Getting Started\nThis plugin requires Grunt `~0.4.0`\n\nIf you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:\n\n```shell\nnpm install grunt-contrib-connect --save-dev\n```\n\nOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:\n\n```js\ngrunt.loadNpmTasks('grunt-contrib-connect');\n```\n\n\n\n\n## Connect task\n_Run this task with the `grunt connect` command._\n\nNote that this server only runs as long as grunt is running. Once grunt's tasks have completed, the web server stops. This behavior can be changed with the [keepalive](#keepalive) option, and can be enabled ad-hoc by running the task like `grunt connect:keepalive`.\n\nThis task was designed to be used in conjunction with another task that is run immediately afterwards, like the [grunt-contrib-qunit plugin](https://github.com/gruntjs/grunt-contrib-qunit) `qunit` task.\n### Options\n\n#### port\nType: `Integer`\nDefault: `8000`\n\nThe port on which the webserver will respond. The task will fail if the specified port is already in use.\n\n#### hostname\nType: `String`\nDefault: `'localhost'`\n\nThe hostname the webserver will use.\n\n#### base\nType: `String`\nDefault: `'.'`\n\nThe base (or root) directory from which files will be served. Defaults to the project Gruntfile's directory.\n\n#### keepalive\nType: `Boolean`\nDefault: `false`\n\nKeep the server alive indefinitely. Note that if this option is enabled, any tasks specified after this task will _never run_. By default, once grunt's tasks have completed, the web server stops. This option changes that behavior.\n\nThis option can also be enabled ad-hoc by running the task like `grunt connect:targetname:keepalive`\n\n#### middleware\nType: `Function`\nDefault:\n\n```js\nfunction(connect, options) {\n return [\n // Serve static files.\n connect.static(options.base),\n // Make empty directories browsable.\n connect.directory(options.base),\n ];\n}\n```\n\nLets you add in your own Connect middlewares. This option expects a function that returns an array of middlewares. See the [project Gruntfile][] and [project unit tests][] for a usage example.\n\n[project Gruntfile]: Gruntfile.js\n[project unit tests]: test/connect_test.js\n\n### Usage examples\n\n#### Basic Use\nIn this example, `grunt connect` (or more verbosely, `grunt connect:server`) will start a static web server at `http://localhost:9001/`, with its base path set to the `www-root` directory relative to the gruntfile, and any tasks run afterwards will be able to access it.\n\n```javascript\n// Project configuration.\ngrunt.initConfig({\n connect: {\n server: {\n options: {\n port: 9001,\n base: 'www-root'\n }\n }\n }\n});\n```\n\nIf you want your web server to use the default options, just omit the `options` object. You still need to specify a target (`uses_defaults` in this example), but the target's configuration object can otherwise be empty or nonexistent. In this example, `grunt connect` (or more verbosely, `grunt connect:uses_defaults`) will start a static web server using the default options.\n\n```javascript\n// Project configuration.\ngrunt.initConfig({\n connect: {\n uses_defaults: {}\n }\n});\n```\n\n#### Multiple Servers\nYou can specify multiple servers to be run alone or simultaneously by creating a target for each server. In this example, running either `grunt connect:site1` or `grunt connect:site2` will start the appropriate web server, but running `grunt connect` will run _both_. Note that any server for which the [keepalive](#keepalive) option is specified will prevent _any_ task or target from running after it.\n\n```javascript\n// Project configuration.\ngrunt.initConfig({\n connect: {\n site1: {\n options: {\n port: 9000,\n base: 'www-roots/site1'\n }\n },\n site2: {\n options: {\n port: 9001,\n base: 'www-roots/site2'\n }\n }\n }\n});\n```\n\n#### Roll Your Own\nLike the [Basic Use](#basic-use) example, this example will start a static web server at `http://localhost:9001/`, with its base path set to the `www-root` directory relative to the gruntfile. Unlike the other example, this is done by creating a brand new task. in fact, this plugin isn't even installed!\n\n```javascript\n// Project configuration.\ngrunt.initConfig({ /* Nothing needed here! */ });\n\n// After running \"npm install connect --save-dev\" to add connect as a dev\n// dependency of your project, you can require it in your gruntfile with:\nvar connect = require('connect');\n\n// Now you can define a \"connect\" task that starts a webserver, using the\n// connect lib, with whatever options and configuration you need:\ngrunt.registerTask('connect', 'Start a custom static web server.', function() {\n grunt.log.writeln('Starting static web server in \"www-root\" on port 9001.');\n connect(connect.static('www-root')).listen(9001);\n});\n```\n\n\n## Release History\n\n * 2013-03-07 v0.2.0 Upgrade connect dependency\n * 2013-02-17 v0.1.2 Ensure Gruntfile.js is included on npm.\n * 2013-02-15 v0.1.1 First official release for Grunt 0.4.0.\n * 2013-01-18 v0.1.1rc6 Updating grunt/gruntplugin dependencies to rc6. Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions.\n * 2013-01-09 v0.1.1rc5 Updating to work with grunt v0.4.0rc5.\n * 2012-11-01 v0.1.0 Work in progress, not yet officially released.\n\n---\n\nTask submitted by [\"Cowboy\" Ben Alman](http://benalman.com)\n\n*This file was generated on Thu Mar 07 2013 01:11:17.*\n",
"readmeFilename": "README.md",
"_id": "grunt-contrib-connect@0.2.0",
"_from": "grunt-contrib-connect@~0.2.0"
}