import gulp from "gulp";
import less from "gulp-less";
import rename from "gulp-rename";
import sourcemaps from "gulp-sourcemaps";

function styles() {
  return gulp.src("less/donjon-et-cie.less")
    .pipe(sourcemaps.init())
    .pipe(less())
    .pipe(rename("donjon-et-cie.css"))
    .pipe(sourcemaps.write("."))
    .pipe(gulp.dest("styles/"));
}

function watchFiles() {
  gulp.watch("less/**/*.less", styles);
}

export { styles };
export const build = gulp.series(styles);
export const watch = gulp.series(build, watchFiles);
export default build;
