Skip to content

Instantly share code, notes, and snippets.

@kevinSuttle
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinSuttle/8877120 to your computer and use it in GitHub Desktop.
Save kevinSuttle/8877120 to your computer and use it in GitHub Desktop.
gulp-nodemon console error
var express = require('express'),
app = express(),
fs = require('fs'),
hbs = require('hbs'),
Docs = require('./controllers/Docs');
var port = (process.env.VCAP_APP_PORT || 3002);
var host = (process.env.VCAP_APP_HOST || 'localhost');
app.engine('html', hbs.__express);
app.set('view engine', 'html');
app.set('views', __dirname + '/templates');
app.use(express.static('public'));
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.session({secret: "kqsdjfmlksdhfhzirzeoibrzecrbzuzefcuercazeafxzeokwdfzeijfxcerig"}));
app.all('/', function(req, res, next) {
Docs.runDefault(req,res,next);
});
app.all('/docs', function(req, res, next) {
Docs.runDefault(req,res,next);
});
app.all('/docs/*',function(req, res, next){
Docs.run(req,res,next);
});
app.listen(port);
console.log('ping');
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
imagemin = require('gulp-imagemin'),
rename = require('gulp-rename'),
notify = require('gulp-notify'),
nodemon = require('gulp-nodemon'),
clean = require('gulp-clean'),
livereload = require('gulp-livereload'),
lr = require('tiny-lr'),
server = lr();
gulp.task('sass-styles', function() {
return gulp.src('public/sass/index.scss')
.pipe(sass({ style: 'nested' }))
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
.pipe(gulp.dest('public/css/'))
.pipe(livereload(server))
.pipe(notify({ message: 'Sass-styles task complete' }));
});
gulp.task('compress', function() {
return gulp.src('public/images/*.png')
.pipe(imagemin({ optimizationLevel: 5, progressive: true, interlaced: true }))
.pipe(gulp.dest('public/images'))
.pipe(livereload(server))
.pipe(notify({ message: 'Image compression task complete' }));
});
gulp.task('watch', function() {
server.listen(35729, function (err) {
if (err) {
return console.log(err)
};
console.log('server connected');
// Watch tasks go inside inside server.listen()
// Watch all files in /public
gulp.watch('public/**/*.scss', ['sass-styles']);
gulp.watch('public/**/*.png', ['compress']);
});
});
gulp.task('nodemon', function(){
nodemon({script:'app.js'});
});
gulp.task('default', ['watch','nodemon'], function() {
gulp.start('sass-styles', 'compress');
});
~/Code/app-prototype master
❯ node app.js
connect.multipart() will be removed in connect 3.0
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
connect.limit() will be removed in connect 3.0
ping
^C
~/Code/app-prototype master
❯ nodemon
7 Feb 23:30:13 - [nodemon] v1.0.14
7 Feb 23:30:13 - [nodemon] to restart at any time, enter `rs`
7 Feb 23:30:13 - [nodemon] watching: *.*
7 Feb 23:30:13 - [nodemon] starting `node app.js`
connect.multipart() will be removed in connect 3.0
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
connect.limit() will be removed in connect 3.0
ping
^C
~/Code/app-prototype master
❯ gulp
[gulp] Using file /Users/kevinsuttle/Code/app-prototype/Gulpfile.js
[gulp] Working directory changed to /Users/kevinsuttle/Code/app-prototype
[gulp] Running 'watch'...
[gulp] Finished 'watch' in 1.53 ms
[gulp] Running 'nodemon'...
[gulp] Finished 'nodemon' in 1.9 ms
[gulp] Running 'default'...
[gulp] Running 'sass-styles'...
[gulp] Running 'compress'...
[gulp] Finished 'default' in 59 ms
server connected
[nodemon] v1.0.14
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node app.js`
[gulp] index.css was reloaded.
[gulp] Finished 'sass-styles' in 930 ms
[gulp] gulp-imagemin: ✔ glyphicons-halflings-white.png (already optimized)
[gulp] glyphicons-halflings-white.png was reloaded.
[gulp] gulp-imagemin: ✔ glyphicons-halflings.png (already optimized)
[gulp] glyphicons-halflings.png was reloaded.
[gulp] Finished 'compress' in 1.41 s
^C
~/Code/app-prototype master
❯ gulp nodemon
[gulp] Using file /Users/kevinsuttle/Code/app-prototype/Gulpfile.js
[gulp] Working directory changed to /Users/kevinsuttle/Code/app-prototype
[gulp] Running 'nodemon'...
[gulp] Finished 'nodemon' in 2.07 ms
[nodemon] v1.0.14
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node app.js`
^C
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment