K
K
kolymbia2021-06-08 22:04:26
JavaScript
kolymbia, 2021-06-08 22:04:26

Wrong file showing in browsersync plugin?

I started building gulp, connected Browsersync and file-include, files are connected but for some reason Error not found is displayed

const fileInclude = require('gulp-file-include');

let project_folder = "dist";
let source_folder = "#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: source_folder + "/*.html",
        css: source_folder + "/scss/style.scss",
        js: source_folder + "/js/script.js",
        img: source_folder + "/img/**/*.{jpg,png,svg,gif,ico,webp}",
        fonts: source_folder + "/fonts/*.ttf",
    },
    watch: {
        html: source_folder + "/**/*.html",
        css: source_folder + "/scss/**/*.scss",
        js: source_folder + "/js/**/*.js",
        img: source_folder + "/img/**/*.{jpg,png,svg,gif,ico,webp}",
    },
    clean: "./" + project_folder + "/"
}

let { src, dest } = require('gulp'),
    gulp = require('gulp'),
    browsersync = require('browser-sync').create();


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())
}

function watchFiles(params) {
    gulp.watch([path.watch.html], html);
}

let build = gulp.series(html);
let watch = gulp.parallel(build, watchFiles, browserSync);


exports.html = html;
exports.build = build;
exports.watch = watch;
exports.default = watch;

60bfbec9b1023375141978.png
What is written in the terminal:
PS C:\User\Admin\Desktop\html&css\ПРИМЕР> gulp
[22:03:00] Using gulpfile ~\Desktop\html&css\sample\gulpfile.js
[22:03:00] Starting 'default'...
[22:03:00] Starting 'watchFiles'...
[22:03:00] Starting 'browserSync'...
[22:03:00] Starting 'html'...
[Browsersync] 2 files changed (header.html, index.html)
[22:03:00] Finished 'html' after 108 ms
[Browsersync] Access URLs:
 --------------------------------------
       Local: http://localhost:3002
    External: http://26.88.229.176:3002
 --------------------------------------
          UI: http://localhost:3003
 UI External: http://localhost:3003
 --------------------------------------
[Browsersync] Serving files from: ./


60bfc1057388b397502513.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Froggyweb, 2021-06-08
@kolymbia

.pipe(gulp.dest('./));

gulp does not know where to put the result
never name folders in the project path with Russian characters. and the username too if it is part of the path. otherwise you won't end up with jambs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question