const gulp = require("gulp");
var sass = require("gulp-sass");
sass.compiler = require("node-sass");

function copyImages(cb) {
  gulp.src("./src/images/*.png").pipe(gulp.dest("./dist/images"));
  cb();
}

function copyFonts(cb) {
  gulp
    .src("./src/assets/webfonts/*.*")
    .pipe(gulp.dest("./dist/assets/webfonts"));
  cb();
}

function copyJS(cb) {
  gulp.src("./src/assets/js/*.js").pipe(gulp.dest("./dist/assets/js"));
  cb();
}

function copyCSS(cb) {
  gulp.src("./src/assets/css/*.css").pipe(gulp.dest("./dist/assets/css"));
  cb();
}

function copyHtml(cb) {
  gulp.src("./src/index.html").pipe(gulp.dest("./dist"));
  cb();
}

function buildSass(cb) {
  gulp
    .src("./src/assets/sass/*.scss")
    .pipe(sass().on("error", sass.logError))
    .pipe(gulp.dest("./dist/assets/css"));
  cb();
}

exports.default = gulp.parallel(
  copyImages,
  copyFonts,
  copyJS,
  copyCSS,
  copyHtml,
  buildSass
);
