Answer the question
In order to leave comments, you need to log in
GULP Cannot GET / why error?
Hello! When running gulp, the page localhost:3000 opens with a Cannot GET / error. The question is, what could be wrong?
gulpfile.js
let project_folder = "dist";
let source_foled = "src";
let path = {
build: {
html: project_folder + "/",
css: project_folder + "/css/",
js: project_folder + "/js/",
img: project_folder + "/img/",
fonts: project_folder + "/fonts/",
},
src: {
html: project_folder + "/*.html",
css: project_folder + "/scss/style.scss",
js: project_folder + "/js/script.js",
img: project_folder + "/img/**/*.{jpg,png,svg,gif,ico,webp}",
fonts: project_folder + "/fonts/*.ttf",
},
watch: {
html: project_folder + "/**/*.html",
css: project_folder + "/scss/**/*.scss",
js: project_folder + "/js/**/*.js",
img: project_folder + "/img/**/*.{jpg,png,svg,gif,ico,webp}"
},
clean: "./" + project_folder + "/"
}
let { src, dest } = require('gulp'),
gulp = require('gulp'),
browsersync = require("browser-sync").create();
fileinclude = require("gulp-file-include");
function browserSync(params) {
browsersync.init({
server: {
baseDir: "./" + project_folder + "/"
},
port: 3000,
notify: false
})
}
function html() {
return src(path.src.html)
.pipe(fileinclude())
.pipe(dest(path.build.html))
.pipe(browsersync.stream())
}
let build = gulp.series(html);
let watch = gulp.parallel(build, browserSync);
exports.html = html;
exports.build = build;
exports.watch = watch;
exports.default = watch;
E:\OS\OpenServer\domains\im.local>gulp
[19:02:48] Using gulpfile E:\OS\OpenServer\domains\im.local\gulpfile.js
[19:02:48] Starting 'default'...
[19:02:48] Starting 'browserSync'...
[19:02:48] Starting 'html'...
[19:02:48] Finished 'html' after 34 ms
[Browsersync] Access URLs:
--------------------------------------
Local: http://localhost:3000
External: http://192.168.1.103:3000
--------------------------------------
UI: http://localhost:3001
UI External: http://localhost:3001
--------------------------------------
[Browsersync] Serving files from: ./dist/
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question