2

does anybody know how to run JSCS from gulp with parameter ? I want to add -x options which autoformats script (see https://twitter.com/jscs_dev). Orginally, I can type in console:

jscs my_Path -x

I want do do the same, just in gulp. My gulp code (simplify):

var jscs    = require('gulp-jscs');
var autoFormat = "-x";
var testStream = gulp.src('/testfolder/*.js');
return testStream.pipe(jscs());

Thanks for any help.

TMachna
  • 279
  • 1
  • 2
  • 10

2 Answers2

2

You should use this configuration:

gulp.task('default', function () {
return gulp.src('src/app.js')
    .pipe(jscs({
        fix: true
    }))
    .pipe(gulp.dest('src'));
});

Like stated here: https://github.com/jscs-dev/gulp-jscs and use the last version of the plugin (1.6.0). I have tried it but it's not working for me. Maybe they are still fixing some problems...

agiannetti
  • 151
  • 2
  • 10
0

The new autoformat feature was released one week for the version 1.12 of JSCS.

Checking the gulp-jscs source you can see that it's still using version 1.8 of JSCS, and it's been a while since the repo has been updated. With this new feature it might be possible that in the next few days we're going to have an update for gulp and grunt.

I guess for now, you can try using gulp-shell or tweak the gulp-jscs source to support autoformat.

Cheers

Rigotti
  • 2,766
  • 23
  • 28