R
R
redsiger2021-06-20 18:56:38
css
redsiger, 2021-06-20 18:56:38

Why doesn't Gulp create a "dist" folder?

I have two different projects. Both have gulpfile.js, package.json and package-lock.json. The folder structure is absolutely identical. When I run gulp in the folder of the first project, everything goes fine: I get a dist folder with all the internals. But when I try it on the second it doesn't happen. The dist folder is simply not created. And I just get "Cannot GET /"

let project_folder = "dist";
let source_folder = "#scr";

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;


structure

project root
    #src
        fonts
        img
        js
            script.js (empty)
        scss
            style.scss (empty)
        index.html (includes <body> tag)
    node_modules
    gulpfile.js
    package-lock.json
    package.json

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Diivjii, 2021-06-21
@redsiger

Good afternoon, look first in your variable

let source_folder = "#scr"; // Очепятка как я понял. Должно быть "src"

Secondly, can you throw off github with the assembly? Take an eye and miss something.

A
Alexander Sharomet, 2021-06-20
@sharomet

Try deleting directory:
node_modules
AND file:
package-lock.json
And install new
npm i

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question