lundi 2 mars 2015

Passing in arguments to gulp tasks

I have a task to run jshint:



gulp.task('lint-scripts', function () {
var jshint = buildTools.jshint,
filesToLint = ...

return gulp
.src(filesToLint)
.pipe(jshint('jshint.json'))
.pipe(jshint.reporter('jshint-stylish'))
//.pipe(jshint.reporter('fail'))
;
});


This is how it should perform during development.


I also need a "release" version of this same task, where this line isn't commented out:



//.pipe(jshint.reporter('fail'))


What's the best way to do this? I don't want to create to duplicate tasks with one line of code difference. Is there a way I can pass in a variable to the task lint-scripts and the fail reporter will optionally be used?


Aucun commentaire:

Enregistrer un commentaire