X
X
xydens2017-03-30 21:10:19
Node.js
xydens, 2017-03-30 21:10:19

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:

gulpfile.js
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');
        });
});

Nodemon is started, automatic reboot is initialized. When the application files change, the application restarts and the page reloads.
I want to use es6 in my application. How can I set up gulp so that babel compiles the application but doesn't save the files but just runs them?
Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan, 2017-03-30
@LiguidCool

Just use cache.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question