gulpfile.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. 'use strict';
  2. var gulp = require('gulp');
  3. var sass = require('gulp-sass');
  4. var watch = require('gulp-watch');
  5. var autoprefixer = require('gulp-autoprefixer');
  6. var jsmin = require('gulp-jsmin');
  7. var rename = require('gulp-rename');
  8. gulp.task('scripts', function () {
  9. gulp.src('./js/*.js')
  10. .pipe(jsmin())
  11. .pipe(rename({suffix: '.min'}))
  12. .pipe(gulp.dest('./js/dist/'));
  13. });
  14. gulp.task('styles', function () {
  15. gulp.src('./css/*.scss')
  16. .pipe(sass().on('error', sass.logError))
  17. .pipe(autoprefixer({
  18. browsers: ['last 2 versions'],
  19. cascade: false
  20. }))
  21. .pipe(gulp.dest('./css/dist'));
  22. // gulp.src('./css/*.css')
  23. // .pipe(autoprefixer({
  24. // browsers: ['last 2 versions'],
  25. // cascade: false
  26. // }))
  27. // .pipe(gulp.dest('./css'));
  28. });
  29. gulp.task('default', function () {
  30. });
  31. // default gulp task
  32. gulp.task('default', ['scripts', 'styles'], function() {
  33. gulp.watch('./css/*.scss', ['styles']);
  34. gulp.watch('./js/*.js', ['scripts']);
  35. });