diff --git a/gulpfile.js b/gulpfile.js
index 62b7658..255c5c0 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -1,5 +1,6 @@
var gulp = require('gulp');
var uglify = require('gulp-uglify');
+var nodemon = require('gulp-nodemon');
gulp.task('watch', function() {
gulp.watch('src/js/main.js', ['build']);
@@ -11,4 +12,16 @@ gulp.task('uglify', function() {
gulp.src('src/js/main.js')
.pipe(uglify())
.pipe(gulp.dest('src/public'));
-});
\ No newline at end of file
+});
+
+gulp.task('start', function() {
+ nodemon({
+ script: 'index.js',
+ ext: 'css js mustache',
+ ignore: ['src/public/main.js'],
+ env: {
+ 'NODE_ENV': 'development'
+ },
+ tasks: ['build']
+ })
+})
diff --git a/package.json b/package.json
index 86088b4..3da148a 100644
--- a/package.json
+++ b/package.json
@@ -18,7 +18,9 @@
"underscore": "^1.8.3",
"uuid": "^2.0.1"
},
- "devDependencies": {},
+ "devDependencies": {
+ "gulp-nodemon": "^2.0.6"
+ },
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"jsbuild": "uglifyjs src/js/main.js --compress --mangle -o src/public/main.js"
diff --git a/readme.md b/readme.md
index 976683c..20cd8c6 100644
--- a/readme.md
+++ b/readme.md
@@ -11,12 +11,7 @@ Install dependencies
You need Gulp installed globally:
npm install -g gulp
- gulp watch
-
-Run the app (nodemon is nice to have)
-
- npm install -g nodemon
- nodemon --watch src index.js -e css,js,mustache
+ gulp start
FattyChat is now running on `http://localhost:3000`
@@ -24,4 +19,4 @@ FattyChat is now running on `http://localhost:3000`
Build source
- gulp build
\ No newline at end of file
+ gulp build
diff --git a/src/js/main.js b/src/js/main.js
index 9fdb1cf..f9270ae 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -25,6 +25,7 @@ $(function() {
var $key = $('#key');
var $genKey = $('.new_key');
var $removeKey = $('#remove_key');
+ var $participants = $('#participants');
var $chatPage = $('.chat.page'); // The chatroom page
@@ -49,11 +50,17 @@ $(function() {
function addParticipantsMessage (data) {
var message = '';
+ var headerMsg = '';
+
if (data.numUsers === 1) {
message += "There's 1 participant";
+ headerMsg = "1 Participant";
} else {
message += "There are " + data.numUsers + " participants";
+ headerMsg = data.numUsers + " participants";
}
+
+ $participants.text(headerMsg);
log(message);
}
diff --git a/src/views/index.mustache b/src/views/index.mustache
index 9325b49..ec14216 100644
--- a/src/views/index.mustache
+++ b/src/views/index.mustache
@@ -24,7 +24,7 @@
- FattyChat
+ FattyChat