var gulp = require('gulp');
var browserSync = require('browser-sync');
var sass = require('gulp-sass');
var prefix = require('gulp-autoprefixer');
var merge = require('merge-stream');
var imagemin = require('gulp-imagemin');
var ghPages = require('gulp-gh-pages');

// Start Static Server with browserSync
gulp.task('server', ['sass'], function() {
    browserSync({
        server: {
            baseDir: "dist/"
        }
    });
});

// Watch SCSS files for changes, recompile, compress, autoprefixed
gulp.task('sass', function() {
    return gulp.src('./_sass/main.scss')
        .pipe(sass({
            outputStyle: 'compressed'
        }).on('error', sass.logError))
        .pipe(prefix(['last 2 versions'], {
            cascade: true
        }))
        .pipe(gulp.dest('./assets/css'))
        .pipe(browserSync.reload({
            stream: true
        }));
});

// Watch SCSS & HTML files, run reload BrowserSync
gulp.task('watch', function() {
    gulp.watch('./_sass/**/*.scss', ['sass']);
    gulp.watch("./*.html").on('change', browserSync.reload);
});

// Task to build to dist
gulp.task('build', () => {
    const task = () => {
        let markup = gulp.src('*.html')
            .pipe(gulp.dest('dist/'));

        let styles = gulp.src('assets/css/main.css')
            .pipe(gulp.dest('dist/css/'));

        let images = gulp.src('assets/images/**/')
            .pipe(imagemin())
            .pipe(gulp.dest('dist/images/'));

        let cname = gulp.src('./CNAME')
                .pipe(gulp.dest('dist/'));

        return merge(markup, styles, images, cname);
    }

    task();
});

// Deploy build dist to branch gh-pages
gulp.task('gh-pages', function() {
    return gulp.src('./dist/**/*')
        .pipe(ghPages({
            force: true
        }));
});

// Deploy build dist to branch gh-pages
gulp.task('deploy', ['build', 'gh-pages']);

// Default task, running just `gulp`
gulp.task('default', ['server', 'watch']);

@@ -2,16 +2,26 @@
 ar gulp 
+          
 = requir
@@ -47,16 +47,19 @@
 serSync 
+   
 = requir
@@ -86,16 +86,26 @@
 ar sass 
+          
 = requir
@@ -131,16 +131,24 @@
  prefix 
+        
 = requir
@@ -181,16 +181,25 @@
 r merge 
+         
 = requir
@@ -230,16 +230,22 @@
 magemin 
+      
 = requir
@@ -276,16 +276,23 @@
 ghPages 
+       
 = requir
@@ -310,16 +310,53 @@
 pages');
+%0Avar del            = require('del');
 %0A%0A// Sta
@@ -1178,16 +1178,23 @@
  to dist
+ folder
 %0Agulp.ta
@@ -1696,32 +1696,126 @@
    task();%0A%7D);%0A%0A
+// Task Delete dist folder%0Agulp.task('clean:dist', function () %7B%0A  return del('./dist');%0A%7D);%0A%0A
 // Deploy build 
@@ -2096,16 +2096,16 @@
  %60gulp%60%0A
-
 gulp.tas
@@ -2118,16 +2118,30 @@
 ault', %5B
+'clean:dist', 
 'server'

Fix task deploy & add taks Clean.