Hello there,
I can’t find a solution for the error that keeps appearing during deployment. Image below.
I thought I fixed it because I put a task called “build” with all my tasks inside and that didn’t work. I’m no expert on gulp, this is the first time using it and I can’t make it work. Please help
Here’s the repo: GitHub - jesusrmz19/Portfolio2020: Personal portfolio created in 2020 during the pandemic
Here’s the code of my gulpfile:
const gulp = require(‘gulp’);
const imagemin = require('gulp-imagemin');
const concat = require('gulp-concat');
const terser = require('gulp-terser');
const sourcemaps = require('gulp-sourcemaps');
const postcss = require('gulp-postcss');
const cssnano = require('cssnano');
const { src, series, parallel, dest, watch } = require('gulp');
const jsPath = 'src/js/**/*.js';
const cssPath = 'src/styles/**/*.css';
function copyIndex() {
return src('src/*.html').pipe(gulp.dest('dist'));
}
function copySuccess() {
return src('src/success/*.html').pipe(gulp.dest('dist/success'));
}
function exportDocs () {
return src('src/docs/*').pipe(gulp.dest('dist/assets/docs'))
}
function imgTask() {
return src('src/images/*').pipe(imagemin()).pipe(gulp.dest('dist/images'));
}
function jsTask() {
return src(jsPath)
.pipe(sourcemaps.init())
.pipe(concat('all.js'))
.pipe(terser())
.pipe(sourcemaps.write('.'))
.pipe(dest('dist/assets/js'));
}
function cssTask() {
return src(cssPath)
.pipe(sourcemaps.init())
.pipe(concat('style.css'))
.pipe(postcss([cssnano()]))
.pipe(sourcemaps.write('.'))
.pipe(dest('dist/assets/css'));
}
function fontsTask() {
return src('src/Fonts/**/*').pipe(gulp.dest('dist/assets/fonts'));
}
function watchTask() {
watch([cssPath, jsPath], { interval: 1000 }, parallel(cssTask, jsTask));
}
gulp.task("build", ["copyIndex", "copySucess", "imgTask", "fontsTask", "cssTask", "jsTask", "exportDocs"]);
gulp.task("build-preview", ["copyIndex", "copySucess", "imgTask", "fontsTask", "cssTask", "jsTask", "exportDocs"]);
exports.exportDocs = exportDocs;
exports.cssTask = cssTask;
exports.jsTask = jsTask;
exports.default = series(parallel(copyIndex, copySuccess, imgTask, jsTask, cssTask, fontsTask, exportDocs),watchTask);
I even created a netlify.toml file that I have no idea what it does, but found it in a solution, but it still doesn’t work.
# global context
[build]
publish = "dist"
command = "gulp build"
# build a preview (optional)
[context.deploy-preview]
command = "gulp build-preview"
# build a branch with debug (optional)
[context.branch-deploy]
command = "gulp build-debug"