gulpfile.js 820 B

12345678910111213141516171819202122232425262728293031323334353637
  1. var gulp = require('gulp'),
  2. jshint = require('gulp-jshint'),
  3. uglify = require('gulp-uglify'),
  4. rename = require('gulp-rename'),
  5. notify = require('gulp-notify');
  6. gulp.task('default', function() {
  7. gulp.start('scripts');
  8. });
  9. gulp.task('scripts', function() {
  10. return gulp.src([
  11. 'jquery.webticker.js'
  12. ])
  13. .pipe(jshint('.jshintrc'))
  14. .pipe(jshint.reporter('default'))
  15. .pipe(rename({suffix: '.min'}))
  16. .pipe(uglify()).on('error', errorHandler)
  17. .pipe(gulp.dest('.',{overwrite: true}))
  18. .pipe(notify({ message: 'Scripts task complete' }));
  19. });
  20. // Watch
  21. gulp.task('watch', function() {
  22. // Watch .js files
  23. gulp.watch('jquery.webticker.js', ['scripts']);
  24. });
  25. // Handle the error
  26. function errorHandler (error) {
  27. console.log(error.toString());
  28. this.emit('end');
  29. }