@kolymbia

Показывается не тот файл в плагине browsersync?

Начал делать сборку gulp, подключил Browsersync и file-include, файлы подключаются но выводится почему-то Error not found
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
Что в терминале пишется:
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
  • Вопрос задан
  • 28 просмотров
Решения вопроса 1
@Froggyweb
.pipe(gulp.dest('./));

gulp не знает куда складывать результат
никогда не называй папки в пути проекта русскими символами. и имя пользователя тоже, если оно участвует в пути. иначе косяков не оберёшься.
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы