Answer the question
In order to leave comments, you need to log in
How to build an Express project using Gulp, Babel, nodemon?
Greetings.
I am learning node.js and I have a problem.
I am writing a project in Express, for assembly (which is not yet available) I use Gulp. I am running a project with nodemon. Right now gulpfile.js looks something like this:
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var nodemon = require('gulp-nodemon');
var babel = require("gulp-babel");
gulp.task('default', ['browser-sync'], function () {
});
gulp.task('browser-sync', ['nodemon'], function() {
browserSync.init({
server: false,
proxy: "http://localhost:3000",
port: 3020,
ui: {
port: 3030
}
});
});
gulp.task('nodemon', function (cb) {
var started = false;
return nodemon({
script: 'bin/www'
})
.on('start', function () {
if (!started) {
cb();
started = true;
}
})
.on('restart', function () {
setTimeout(function reload() {
browserSync.reload({
stream: false
});
}, 500);
console.log('restarted');
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question