JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 16918
  • Score
    100M100P100Q136826F
  • License MIT

Grunt task to run a nodemon monitor of your node.js server

Package Exports

  • grunt-nodemon

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (grunt-nodemon) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

grunt-nodemon

NPM version
Dependency Status
Travis Status

Run nodemon as a grunt task for easy configuration and integration with the rest of your workflow.

Getting Started

If you haven't used grunt before, be sure to check out the Getting Started guide, as it explains how to create a gruntfile as well as install and use grunt plugins. Once you're familiar with that process, install this plugin with this command:

npm install grunt-nodemon --save-dev

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

grunt.loadNpmTasks('grunt-nodemon');

Documentation

Usage

The minimal usage of nodemon runs with no options:

nodemon: {
  dev: {}
}

When this is run, nodemon will look at the package.json file for the main property and run its value as a command in node.

Here is a config that uses all of the available options for nodemon:

nodemon: {
  prod: {
    options: {
      file: 'test/server.js',
      args: ['production'],
      ignoredFiles: ['README.md', 'node_modules/**'],
      watchedExtensions: ['js', 'coffee'],
      watchedFolders: ['test', 'tasks'],
      debug: true,
      delayTime: 1
    }
  },
  exec: {
    options: {
      exec: 'less'
    }
  }
}

A common use case is to run nodemon with other tasks concurrently. This can be achieved with the following config, which uses grunt-concurrent to run nodemon and watch in a single terminal tab:

concurrent: {
  target: {
    tasks: ['nodemon', 'watch'],
    options: {
      logConcurrentOutput: true
    }
}

Options

file

Type: string

This is file that nodemon runs and restarts when changes are detected.

args

Type: Array of strings

This is the list of arguments to be passed to your file.

ignoredFiles

Type: Array of string globs

This is a list of ignored files specified by a glob pattern. Here is an explanation of how to use the patterns to ignore files. This task will create a .nodemonignore file in your repo based on these settings which nodemon reads when it starts.

watchedExtensions

Type: Array of strings Default: 'js'

This is a list of file extensions to watch for changes. By default nodemon only watches JavaScript files.

watchedFolders

Type: Array of strings Default: '.'

List of folders to watch for changes if you don't want to watch the root folder and its subdirectories.

debug

Type: Boolean

Optionally launch the node.js debug server.

delayTime

Type: Number

Delay the restart of nodemon by a number of seconds when compiling a large amount of files so that the app doesn't needlessly restart after each file.

exec

Type: string

You can use nodemon to execute a command outside of node. Use this option to specify a command as a string with the argument being the file parameter above. You can read more on exec here.

Changelog

0.0.0 - Initial release

0.0.1 - Added warning if nodemon isn't installed as a global module

0.0.2 - Removes .nodemonignore if it was previously generated and then the ignoredFiles option is removed

0.0.3 - Uses local version of nodemon for convenience and versioning