Skip to content

Commit

Permalink
Adding server task documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
cowboy committed Mar 12, 2012
1 parent 891f045 commit 697020b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions docs/task_server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[Grunt homepage](https://github.com/cowboy/grunt) | [Documentation table of contents](toc.md)

# server (built-in task)
Start a static web server.

## About

This task starts a static web server on a specified port, at a specified path, which runs as long as grunt is running. Once grunt's tasks have completed, the web server stops.

For more information on general configuration options, see the [configuring grunt](configuring.md) page.

## Usage examples

In this example, `grunt server` will start a static web server at `http://localhost:8000/`, with its base path set to the gruntfile's directory. Of course, it will then immediately stop serving files, because grunt exits automatically when there are no more tasks to run.

The `server` task is most useful when used in conjunction with another task, like the [qunit](task_qunit.md) task.

```javascript
/*global config:true, task:true*/
config.init({
server: {
port: 8000,
base: '.'
}
}
});
```

See the [server task source](https://github.com/cowboy/grunt/blob/master/tasks/server.js) for more information.
2 changes: 1 addition & 1 deletion docs/toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
* [init](task_init.md) - Generate project scaffolding from a predefined template.
* [lint](task_lint.md) - Validate files with [JSHint][jshint].
* [qunit](task_qunit.md) - Run [QUnit][qunit] unit tests in a headless [PhantomJS][phantom] instance.
* [server](task_server.md) - Start a static web server.
* _(more documentation coming soon)_

<!--
* [min](task_min.md) - Minify files with [UglifyJS][uglify].
* [server](task_server.md) - Start a static web server.
* [test](task_test.md) - Run unit tests with [nodeunit][nodeunit].
* [watch](task_watch.md) - Run predefined tasks whenever watched files change.
-->
Expand Down

0 comments on commit 697020b

Please sign in to comment.