const gulp = require("gulp"), gulpif = require("gulp-if"), del = require("del"), connect = require("gulp-connect"), sourcemaps = require("gulp-sourcemaps"), autoprefixer = require("gulp-autoprefixer"), rename = require("gulp-rename"), sass = require("gulp-sass")(require("sass")); /** ___ _ _ _ _ / __| |_ ___ __| |_____ _ _| |_ ___ ___| |_ _ _ _ __ | (__| ' \/ -_) _| / / _ \ || | _| (_- webpack(webpackConfig, (err, stats) => { if (err) console.log("Webpack", err); console.log( stats.toString({ all: false, modules: false, maxModules: 0, errors: true, warnings: true, moduleTrace: true, errorDetails: true, colors: true, chunks: true, }) ); resolve(); connect.reload(); }) ); } function customFonts() { return gulp .src(paths.fonts.src) .pipe( rename((path) => ({ dirname: "", basename: path.basename, extname: path.extname + ".css", })) ) .pipe(gulp.dest(paths.outputStatic)) .pipe(connect.reload()); } function watch() { devServer(); gulp.watch(paths.scripts.watch, { ignoreInitial: false }, scripts); gulp.watch(paths.styles.watch, { ignoreInitial: false }, styles); gulp.watch(paths.fonts.src, { ignoreInitial: false }, customFonts); } function devServer() { connect.server({ root: paths.output, livereload: true, port: 3000, }); } const build = gulp.series(clean, gulp.parallel(scripts, styles, customFonts)); exports.build = build; exports.clean = clean; exports.scripts = scripts; exports.styles = styles; exports.devServer = devServer; exports.watch = gulp.series(build, watch);