gulpfile.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. var gulp = require('gulp'),
  2. plugins = require("gulp-load-plugins")();
  3. paths = {
  4. view: [
  5. 'bower_components/jQuery/dist/jquery.min.js',
  6. 'bower_components/js-md5/js/md5.min.js',
  7. 'bower_components/mousetrap/mousetrap.min.js',
  8. 'bower_components/mousetrap/plugins/global-bind/mousetrap-global-bind.min.js',
  9. '../assets/js/_frameworks.js',
  10. '../assets/js/build.js',
  11. '../assets/js/view/main.js'
  12. ],
  13. js: [
  14. 'bower_components/jQuery/dist/jquery.min.js',
  15. 'bower_components/js-md5/js/md5.min.js',
  16. 'bower_components/mousetrap/mousetrap.min.js',
  17. 'bower_components/mousetrap/plugins/global-bind/mousetrap-global-bind.min.js',
  18. '../assets/js/*.js'
  19. ],
  20. css: [
  21. '../assets/scss/main.scss'
  22. ]
  23. }
  24. gulp.task('view', function () {
  25. gulp.src(paths.view)
  26. .pipe(plugins.concat('view.js', {newLine: "\n"}))
  27. .pipe(plugins.uglify())
  28. .pipe(gulp.dest('../assets/min/'));
  29. });
  30. gulp.task('js', function () {
  31. gulp.src(paths.js)
  32. .pipe(plugins.concat('main.js', {newLine: "\n"}))
  33. .pipe(plugins.uglify())
  34. .pipe(gulp.dest('../assets/min/'));
  35. });
  36. gulp.task('css', function () {
  37. gulp.src(paths.css)
  38. .pipe(plugins.sass())
  39. .pipe(plugins.concat('main.css', {newLine: "\n"}))
  40. .pipe(plugins.autoprefixer('last 4 versions', '> 5%'))
  41. .pipe(plugins.minifyCss())
  42. .pipe(gulp.dest('../assets/min/'));
  43. });
  44. gulp.task('default', ['view', 'js', 'css']);
  45. gulp.task('watch', ['default'], function() {
  46. gulp.watch(paths.view, ['view']);
  47. gulp.watch(paths.js, ['js']);
  48. gulp.watch(paths.css, ['css']);
  49. });