I've automated all tasks from my project using gulp.
However I have a specific name folder with square brackets in its name (yes, it's required to have square brackets in it's name on purpose) and this seems not to work with gulp. I need to target that folder and minify the javascript in it. I tried using a regex match pattern, but as long as I read gulp is using blob or either I don't understand blob or I am doing this wrong
Let's say I have a folder named with scripts inside of it : [testFolder] > script1.js, script2.js This is how I target it with code.
function minifyJs() {
return gulp.src('resources/[testFolder]/**/*.js') // not working
return gulp.src('resources/\[.*testFolder\]/**/*.js) // not working either desipte I've tested
it on various things
.pipe(minify({ noSource: true }))
.pipe(gulp.dest('resources/[testFolder]')) // this is working pretty much fine
}
What am I doing wrong?
Okay, after some days of trying to make it work, it seems this is working for both macOS / linux and Windows (tested on windows 10) Thanks for @Saeed help in the answer below.
// MAC / LINUX OS
function minifyJs() {
return gulp.src('resources/\\[testFolder\\]/**/*.js') // note the \\[name\\] escape here
.pipe(minify({ noSource: true }))
.pipe(gulp.dest('resources/[testFolder]')) // this is working for both
}
// WINDOWS
function minifyJs() {
return gulp.src('resources/[[]testFolder]/**/*.js') // note [[]name] escape here
.pipe(minify({ noSource: true }))
.pipe(gulp.dest('resources/[testFolder]')) // this is working for both
}
This is for windows