How to use a Gulp file for production and development?

1

I was researching how to create a Gulp file that understands how to differentiate when it is for production and when it is for development. I found the plugin below, and would you like to know if this is the ideal way to do this differentiation today?

link

In my search, I found this link below, but since it was created in 2014, do I believe that this form is out of date or am I wrong? It's a little bit like the plugin above, because it creates two addresses before.

link

And if there is any treatment or other plugin that I can use in this doubt?

    
asked by anonymous 21.02.2017 / 19:44

1 answer

0

I found a way with gulp-util :

link

After putting const util = require('gulp-util') into the gulpfile.js file. You can create a default task with a production condition to perform another task, if you need to:

gulp.task('default', function() {
    if(util.env.prod){
        gulp.start('producao')
    } else {
        gulp.start('desenv')
    }
})

After that, just use the gulp command at the prompt for production with the same name after util.env. :

gulp --prod
    
22.03.2017 / 14:19