Skip to content

Instantly share code, notes, and snippets.

@iorionda
Last active December 7, 2015 09:48
Show Gist options
  • Save iorionda/6bedc1721d6dff9d79ad to your computer and use it in GitHub Desktop.
Save iorionda/6bedc1721d6dff9d79ad to your computer and use it in GitHub Desktop.
g = require 'gulp'
$ = require 'gulp-load-plugins'
nodemon = require 'gulp-nodemon'
mocha = require 'gulp-mocha'
browserSync = require 'browser-sync'
g.task 'browserSync', ['nodemon'], ->
browserSync.init null, {
files: ['public/**/*.*', 'views/**/*.*', 'routes/**/*.*'],
proxy: 'http://localhost:3000',
port: 4000
}
g.task 'nodemon', (cd) ->
BROWSER_SYNC_TIMING = 5000
called = false
nodemon {
script: './bin/www',
ext: 'js html css jade styl coffee',
ignore: [
'node_modules',
'bin',
'test'
],
env: {
'NODE_ENV': 'development'
},
stdout: false
}
.on 'start', ->
if(!called)
cd()
called = true
.on 'restart', ->
setTimeout ->
browserSync.reload {stream: false}
, BROWSER_SYNC_TIMING
g.task 'test', ->
g.src ['./test/**/*.js', './test/**/*.coffee']
.pipe mocha {reporter: 'nyan'}
g.task 'default', ['browserSync']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment