E
E
Evgeniy2022-04-12 16:15:59
JavaScript
Evgeniy, 2022-04-12 16:15:59

How to copy a folder with html with internal structure in GULP?

Good afternoon,

for example, the src folder structure:
|__css
|__js
|__page
|____components
|____main
|______index.html
_____catalog
|______catalog.html

Please tell me
how to make the main folder simply copied with the entire internal structure?
(Except for the "components" folder, of course, which contains _header.html , _footer.html , etc...)

let project_folder = require("path").basename(__dirname);
let source_folder = "src";

let fs = require('fs');

let path = {
  build: {
    html: project_folder + basename, 
  },
  src: {
    html: [source_folder + "/page/**/*.html", "!" + source_folder + "/page/**/_*.html"], 
  },
  watch: {
    html: source_folder + "/**/*.html", 
  },
  clean: "./" + project_folder + "/"
}

function html() {
  return src(path.src.html)
    .pipe(fileinclude()) 
    .pipe(dest(path.build.html))
    .pipe(browsersync.stream())
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
black1277, 2022-04-12
@Zheleznov

once I already answered a similar question - it was about folders with pictures, but you can do another folder like that.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question