Advertisement
Guest User

Untitled

a guest
Oct 21st, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Load Gulp and your plugins
  2. var gulp    = require('gulp'),
  3.     connect = require('gulp-connect'),
  4.     stylus  = require('gulp-stylus'),
  5.     plumber = require('gulp-plumber');
  6.  
  7. var paths = {
  8.     styles: 'src/stylus/**/*',
  9.     javascript: 'src/js/**/*',
  10.     html:   '*.html'
  11. };
  12.  
  13. // Connect task
  14. gulp.task('connect', connect.server({
  15.     root: __dirname + '/',
  16.     port: 5000,
  17.     livereload: true,
  18.     open: true
  19. }));
  20.  
  21. // HTML task
  22. gulp.task('html', function () {
  23.     gulp.src('*.html')
  24.         .pipe(connect.reload());
  25. });
  26.  
  27. // Stylus task
  28. gulp.task('stylus', function () {
  29.     gulp.src('src/stylus/*.styl')
  30.         .pipe(plumber())
  31.         .pipe(stylus({
  32.             use: ['nib'],
  33.             set: ['compress']
  34.         }))
  35.         .pipe(gulp.dest('assets/css'))
  36.         .pipe(connect.reload());
  37. });
  38. var uglify = require('gulp-uglify');
  39.  
  40. gulp.task('uglify', function() {
  41.   return gulp.src('src/js/*.js')
  42.     .pipe(uglify())
  43.     .pipe(gulp.dest('assets/js'));
  44. });
  45.  
  46. // Watch task
  47. gulp.task('watch', function () {
  48.     gulp.watch(paths.styles, ['stylus']);
  49.     gulp.watch(paths.javascript, ['uglify']);
  50.     gulp.watch(paths.html, ['html']);
  51. });
  52.  
  53. // Set 'gulp server' for development
  54. gulp.task('default', ['connect', 'uglify', 'stylus', 'watch']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement