L
L
lambakean2020-04-16 21:20:23
JavaScript
lambakean, 2020-04-16 21:20:23

How to use slashes in regex in Gulp?

Hello.
I have two files, relative to the root of the project, which contains gulpfile.js, they have the following paths:
src/index.html
and
src/page1/page1.html

I do this: Next, the pipes must process these two files and place them modified versions to the /build directory. The problem is that only index.html is processed and page1.html is not affected. If the following string is passed to .src(): then none of these files are processed. So the problem is in the slashes inside the +(). Please tell me how to write paths containing a slash in +() I didn't find anything about it on glob's github. https://github.com/isaacs/node-glob
gulp.src("src/+(index.html|page1/page1.html)");


"+(src/index.html|src/page1/page1.html)"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2020-04-17
@Seasle

Why do that when you can just

gulp.src('src/**/*.html')
    .pipe(gulp.dest('build/'));

K
Karpion, 2020-04-17
@Karpion

And what should a plus signify in this case? Maybe throw it out altogether?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question