gulpfile-hint.js 1022 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. module.exports = function(gulp, plugins) {
  2. var argv = require('yargs').argv;
  3. var browserSync = require('browser-sync'),
  4. reload = browserSync.reload,
  5. stylish = require('jshint-stylish');
  6. var that = this;
  7. that.port = +argv.p || 3001;
  8. gulp.task('hint-conn', function() {
  9. browserSync({
  10. ui:false,
  11. server: {
  12. baseDir: "src",
  13. directory: false
  14. },
  15. notify: false,
  16. ghostMode: false,
  17. port: that.port,
  18. open: false
  19. })
  20. })
  21. gulp.task('hint-js', function() {
  22. return gulp.src(['src/js/**', '!lib/**'])
  23. .pipe(plugins.cached('jshint'))
  24. .pipe(plugins.jshint('.jshintrc'))
  25. .pipe(plugins.jshint.reporter(stylish, { verbose: true }))
  26. .pipe(reload({stream:true}))
  27. });
  28. gulp.task('hint', ['hint-js', 'hint-conn'], function(){
  29. gulp.watch('src/js/**', ['hint-js'])
  30. })
  31. }