lundi 26 décembre 2016

declaring root of server with if statement

I have a project which i can't test it at the moment.In gulp file i have a task 'server' :

gulp.task('connect', function() {
connect.server({
root: ( 'build' ),
livereload: true,
 port: 5000,
 middleware: function(connect, opt) {
        return [
            proxy('/api', {
                target: 'http://localhost:3000',
                changeOrigin:true,
                ws: true    
            })
        ]
    }
});
});

and variable :

var ifProduction = gutil.env.production || false;

Can someone tell me if its possible to set an if statement for the root? Something like that:

root: ( ifProduction ? 'build' : 'temp')

Would that work?

Aucun commentaire:

Enregistrer un commentaire