K
K
KrupAch2021-05-22 01:32:18
gulp.js
KrupAch, 2021-05-22 01:32:18

Gulp doesn't create folder, what's the problem?

Dear experts, I can't understand what I'm wrong about according to GULP.
Setting up gulp.js
I decided to check how folders will be created and how files will be transferred.
But I did not see the expected result.
It will sit for more than an hour, checking for errors and never found a single one ...
Here is the code:

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(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;


I can not find the root of evil ...

The issue was resolved.
If you never know someone will come across, like me:
The name of the folder is "src", the setting is registered through "#", and in the gulp file I registered without a lattice. That was the problem.
In other words, you had to copy the entire folder name into gulp.

Thanks to all.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question