SvetlanaL

gulpfile.js

Nov 23rd, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. var gulp = require('gulp'),
  2. sass = require('gulp-sass'),
  3. autoprefixer = require('gulp-autoprefixer'),
  4. cleanCSS = require('gulp-clean-css'),
  5. rename = require('gulp-rename'),
  6. browserSync = require('browser-sync').create(),
  7. concat = require('gulp-concat'),
  8. runSequence = require('run-sequence'),
  9. uglify = require('gulp-uglify');
  10.  
  11. gulp.task('browser-sync', ['styles', 'scripts'], function() {
  12. browserSync.init({
  13. server: {
  14. baseDir: "./app"
  15. },
  16. notify: false
  17. });
  18. });
  19.  
  20. gulp.task('styles', function () {
  21. return gulp.src('sass/*.sass')
  22. .pipe(sass({
  23. includePaths: require('node-bourbon').includePaths
  24. }).on('error', sass.logError))
  25. .pipe(rename({suffix: '.min', prefix : ''}))
  26. .pipe(autoprefixer({browsers: ['last 15 versions'], cascade: false}))
  27. .pipe(cleanCSS())
  28. .pipe(gulp.dest('app/css'))
  29. .pipe(browserSync.stream());
  30. });
  31.  
  32.  
  33. gulp.task('scripts', function() {
  34. return gulp.src([
  35. './app/libs/modernizr/modernizr.js',
  36. './app/libs/jquery/jquery-1.11.2.min.js',
  37. './app/libs/waypoints/waypoints.min.js',
  38. './app/libs/animate/animate-css.js',
  39. ])
  40. .pipe(concat('libs.js'))
  41. // .pipe(uglify()) //Minify libs.js
  42. .pipe(gulp.dest('./app/js/'));
  43. });
  44.  
  45.  
  46.  
  47. gulp.task('watch', function () {
  48. gulp.watch('sass/*.sass', ['styles']);
  49. gulp.watch('app/libs/**/*.js', ['scripts']);
  50. gulp.watch('app/js/*.js').on("change", browserSync.reload);
  51. gulp.watch('app/*.html').on('change', browserSync.reload);
  52. });
  53.  
  54.  
  55.  
  56.  
  57. gulp.task('default', ['browser-sync', 'watch']);
Add Comment
Please, Sign In to add comment