gulpfile.js 558 B

123456789101112131415161718192021222324252627
  1. 'use strict';
  2. var gulp = require('gulp');
  3. var watch = require('gulp-watch');
  4. var jsmin = require('gulp-jsmin');
  5. var rename = require('gulp-rename');
  6. function handleError(err) {
  7. console.log(err.toString());
  8. // this.emit('end');
  9. }
  10. gulp.task('scripts', function () {
  11. gulp.src('./js/*.js')
  12. .pipe(jsmin())
  13. .pipe(rename({suffix: '.min'}))
  14. .pipe(gulp.dest('./js/dist/'));
  15. });
  16. gulp.task('default', function () {
  17. });
  18. // default gulp task
  19. gulp.task('default', ['scripts'], function() {
  20. gulp.watch('./js/*.js', ['scripts']);
  21. });