Skip to content
A Grunt plugin to run a server indefinitely.
JavaScript
Latest commit 55bb60e Feb 15, 2013 @iammerrick Merge pull request #2 from cloud8421/option-not-to-run-indefinitely
Adds option not to run indefinitely.
Failed to load latest commit information.
example
tasks
.gitignore
.npmignore
LICENSE-MIT
README.md
grunt.js
package.json

README.md

grunt-connect

Run a connect server. The built in Grunt server task is terrific for the great majority of cases, however sometimes you just want to ability to run a web server on a local file system and interact with the files using a web browser. For that reason, grunt-connect's default behaviour is to run indefinitely.

Getting Started

Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-connect

Then add this line to your project's grunt.js gruntfile:

grunt.loadNpmTasks('grunt-connect');

Documentation

Settings

  • port - port to listen, default 1337
  • base - base directory, default ".", unless combine is used
  • combine - combine multiple bases into single server. If file is not found in first one, it tries to find in second, and so on. If base is also specified, it is on first position.

Content of directories is listed. In case multiple bases, it lists only files from first base with given directory (directory contents are not combined).

Since, these tasks are essentially asynchronous tasks that don't close. It's best to target them directly. For example, given the following configuration:

grunt.initConfig({
  connect: {
    example: {
      port: 1337,
      base: 'example'
    },
    test: {
      port: 1338,
      base: 'test',
      keepAlive: false
    },
    meta: {
      port: 1339,
      base: 'tasks'
    },
    combined: {
      port: 1340,
      combine: [
        'example',
        'tasks'
      ]
  }
});

One might target the meta server using grunt connect:meta

License

Copyright (c) 2012 Merrick Christensen Licensed under the MIT license.

Something went wrong with that request. Please try again.