gulpfile.js 929 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. 'use strict';
  2. var gulp = require('gulp');
  3. var less = require('gulp-less');
  4. var LessAutoprefix = require('less-plugin-autoprefix');
  5. var jsmin = require('gulp-jsmin');
  6. var rename = require('gulp-rename');
  7. var watch = require('gulp-watch');
  8. var autoprefix = new LessAutoprefix({ browsers: ['last 2 versions'] });
  9. function handleError(err) {
  10. console.log(err.toString());
  11. // this.emit('end');
  12. }
  13. gulp.task('scripts', function () {
  14. gulp.src('./js/guibik.js')
  15. .pipe(jsmin())
  16. .pipe(rename({suffix: '.min'}))
  17. .pipe(gulp.dest('./js/'));
  18. });
  19. gulp.task('styles', function () {
  20. gulp.src('./less/guibik.less')
  21. .pipe(less({
  22. plugins: [autoprefix]
  23. }))
  24. .pipe(gulp.dest('./css/'));
  25. });
  26. gulp.task('default', function () {
  27. });
  28. // default gulp task
  29. gulp.task('default', ['scripts', 'styles'], function() {
  30. gulp.watch('./less/*.less', ['styles']);
  31. gulp.watch('./js/*.js', ['scripts']);
  32. });