'use strict';

const gulp = require('gulp');
const sass = require('gulp-sass');
const sourcemaps = require('gulp-sourcemaps');
const uglify = require('gulp-uglify');

const ASSET_PATH = './assets';
const SASS_PATH = ASSET_PATH + '/stylesheets';
const IMAGES_PATH = ASSET_PATH + '/images';
const JS_PATH = ASSET_PATH + '/javascripts';
const BUILD_PATH = './public';

//*** SASS compiler task
gulp.task('sass', function () {
  return gulp.src(SASS_PATH + '/**/*.scss')
    .pipe(sourcemaps.init())
    .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
    .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest(BUILD_PATH + '/css'));
});

//*** SASS watch(realtime) compiler task
gulp.task('sass:watch', function () {
  gulp.watch([
    SASS_PATH + '/**/*.scss',
    SASS_PATH + '/**/**/*.scss'
  ], ['sass']);
});

gulp.task('copy:images', function() {
  gulp.src([
    `${ASSET_PATH}/favicon/*`,
  ]).pipe(gulp.dest(BUILD_PATH));

  gulp.src([
    `${ASSET_PATH}/badges/*`,
  ]).pipe(gulp.dest(`${BUILD_PATH}/badges`));

  gulp.src([
    IMAGES_PATH + '/**/*.png',
    IMAGES_PATH + '/**/*.svg'
  ]).pipe(gulp.dest(BUILD_PATH + '/img'))
});

gulp.task('js', function() {
  gulp.src([
    JS_PATH + '/*.js',
    JS_PATH + '/**/*.js'
  ])
  .pipe(sourcemaps.init())
  .pipe(uglify())
  .pipe(sourcemaps.write('./'))
  .pipe(gulp.dest(BUILD_PATH + '/js'))
});


gulp.task('build', function() {
  gulp.start(['sass', 'copy:images', 'js']);
});



@@ -323,24 +323,66 @@
 vascripts';%0A
+const FONTS_PATH = %60$%7BASSET_PATH%7D/fonts%60;%0A
 const BUILD_
@@ -1186,24 +1186,147 @@
 img'))%0A%7D);%0A%0A
+gulp.task('copy:fonts', function () %7B%0A  gulp.src(%5B%0A    %60$%7BFONTS_PATH%7D/*%60%0A  %5D).pipe(gulp.dest(BUILD_PATH + '/fonts'));%0A%7D);%0A%0A
 gulp.task('j
@@ -1598,16 +1598,30 @@
 images',
+ 'copy:fonts',
  'js'%5D);

Add build task for copying fonts.