Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm a new user to gulp.js. I'd like to move all of my non-javascript files to a build directory. What I've got right now is this:

//Test copy
gulp.task('test-copy', function() {
    gulp.src(['myProject/src/**/*.!(js|map|src)'])
        .pipe(gulp.dest('myProject/build'));
});


//Results for various files
myProject/css/style.css //Copied - GOOD
myProject/html/index.html //Copied - GOOD
myProject/js/foo.js //Not Copied - GOOD
myProject/js/bar.min.js //Copied - BAD!
myProject/js/jquery-2.0.3.min.js //Copied - BAD!
myProject/js/jquery-2.0.3.min.map //Copied - BAD!

As you can see, it only matches after the first dot in the file path string, not the last one, as I'd like. How can I modify the glob search string to behave as I'd like?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
590 views
Welcome To Ask or Share your Answers For Others

1 Answer

Try this glob pattern:

myProject/src/**/!(*.js|*.map|*.src)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...