Answer the question
In order to leave comments, you need to log in
How to make a dynamic gulp task?
Good afternoon, I can’t solve the following problem with the assembly of the gulp project in any way.
There is a gallp task that takes the desired file from the folder by name. The name is already in the variable.
For example, like this:
var siteName = 'site-name';
gulp.task('config-js', function() {
return gulp.src('./configs/'+siteName+'.js')
.pipe(gp.concat('config.js'))
.pipe(gulp.dest(distDir + '/js/'))
});
Answer the question
In order to leave comments, you need to log in
Of course you can. Everything is possible.
gulp.task('demo', function(cb){
console.log(process.argv.splice(3));
cb();
});
D:\dev\demo>gulp demo --file2
[02:22:08] Using gulpfile D:\dev\demo\gulpfile.js
[02:22:08] Starting 'demo'...
[ '--file2' ]
[02:22:08] Finished 'demo' after 13 ms
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question