S
S
SA32021-02-20 14:00:25
gulp.js
SA3, 2021-02-20 14:00:25

When setting up GULP, the dist folder is not created, why?

I'm trying to set up a GULP builder, using the video tutorial gulpfile.js

code:

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

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

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


After running the "gulp" command in the terminal, a new window opens in the browser (as it should):
6030eb6eb5743122483996.png
A dist folder should also be created in the root of the project, but nothing happens.
Information from the terminal after running the command:
6030eb993269e674254633.png
Can you please tell me why the dist folder is not created?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
ploskost, 2021-02-26
@SA3

exports.build - build;
You have a hyphen here instead of an equals sign.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question