Coder Social home page Coder Social logo

noxan / gulp-nodemon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jacksongariety/gulp-nodemon

0.0 2.0 0.0 126 KB

A gulp-friendly nodemon wrapper that restarts your app as you develop, and keeps your build system contained to one process.

gulp-nodemon's Introduction

gulp-nodemon

A gulp-friendly nodemon wrapper that restarts your app as you develop, and keeps your build system contained to one process.

Perfect for development.

Usage

nodemon([options])

You can pass an object to gulp-nodemon with options specified in nodemon config.

Example below will start server.js in development mode and watch for changes, as well as watch all .html and .js files in the directory.

{
  script: 'server.js'
, ext: 'js html'
, env: { 'NODE_ENV': 'development' }
}

gulp-nodemon returns a stream just like any other NodeJS stream, except for the on method, which conveniently takes gulp task names to execute.

.on([event], [tasks])

  1. [event] is an event name as a string. See nodemon events. (gulp-nodemon also provides a new event, 'change', which fires before the server restarts so that you can run your compile tasks all within the same gulp process.)
  2. [tasks] A gulp task name, array of gulp task names, or a function to execute.

--debug

You can also pass the debug flag to nodemon through the nodeArgs option

Example below will start server.js in development with --debug flag.

{ 
  script: 'app.js', 
  ext: 'js html', 
  env: { 'NODE_ENV': 'development' } , 
  ignore: ['./build/**'], 
  nodeArgs: ['--debug'] 
}

You can also specify a custom debug port:

nodeArgs: ['--debug=9999']

Example

The following example will run your code with nodemon, lint it when your it change, then log a message when it nodemon runs it again.

// Gulpfile.js
var gulp = require('gulp')
  , nodemon = require('gulp-nodemon')
  , jshint = require('gulp-jshint')

gulp.task('lint', function () {
  gulp.src('./**/*.js')
    .pipe(jshint())
})

gulp.task('develop', function () {
  nodemon({ script: 'server.js', ext: 'html js', ignore: ['ignored.js'] })
    .on('change', ['lint'])
    .on('restart', function () {
      console.log('restarted!')
    })
})

gulp-nodemon's People

Contributors

binarykitchen avatar davelnewton avatar happytobi avatar ryanwild avatar tschaub avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.